localhost1978's picture
download
raw
1.66 kB
import Testing
@testable import SSK_Providers
@testable import SSK_Abstractions
@Suite("AST Extraction Suite", .tags(.ast, .docc))
struct NativeASTProviderTests {
struct ASTTestCase: Sendable {
let source: String
let expectedEntityCount: Int
let expectedTypes: [String]
}
static let testCases: [ASTTestCase] = [
ASTTestCase(
source: "/// An actor\npublic actor VaultManager {}",
expectedEntityCount: 1,
expectedTypes: ["actor"]
),
ASTTestCase(
source: "/// Protocol definition\npublic protocol DataSyncing {\n /// A sync func\n func sync()\n}",
expectedEntityCount: 2,
expectedTypes: ["protocol", "function"]
),
ASTTestCase(
source: "/// Struct doc\npublic struct Config {\n /// Property doc\n public let id: String\n}",
expectedEntityCount: 2,
expectedTypes: ["struct", "property"]
)
]
@Test("Verify DocC entity extraction across syntax varieties", arguments: testCases)
func testDoccEntityExtraction(testCase: ASTTestCase) async throws {
let provider = NativeASTProvider()
let result = await provider.extractDocc(from: testCase.source, sourceFile: "Sources/Module/Sample.swift")
#expect(result.entities.count == testCase.expectedEntityCount)
let extractedTypes = result.entities.map(\.type)
for expectedType in testCase.expectedTypes {
#expect(extractedTypes.contains(expectedType))
}
}
}
extension Tag {
@Tag static var ast: Self
@Tag static var docc: Self
}

Xet Storage Details

Size:
1.66 kB
·
Xet hash:
b1c1c0803d381beeaea5978630ad6fe10a4574a21506d8e75070ae8984513b72

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.