Skip to content

Commit fbccd00

Browse files
leogdionclaude
andcommitted
Fix Android doc test path resolution
On Android, Documentation.docc is copied flat to the working directory without the Sources/SyntaxKit/ prefix. Centralize the prefix logic in resolveFilePath so test methods use short paths and Settings adds the prefix for non-Android platforms. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 426285a commit fbccd00

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Tests/SyntaxDocTests/DocumentationExampleTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ internal struct DocumentationExampleTests {
4242
@Test("Quick Start Guide examples work correctly")
4343
internal func validateQuickStartGuideExamples() throws {
4444
let quickStartFile = try Settings.resolveFilePath(
45-
"Sources/SyntaxKit/Documentation.docc/Tutorials/Quick-Start-Guide.md"
45+
"Documentation.docc/Tutorials/Quick-Start-Guide.md"
4646
)
4747
let results = try testHarness.validateFile(at: quickStartFile)
4848

@@ -57,7 +57,7 @@ internal struct DocumentationExampleTests {
5757
@Test("Creating Macros tutorial examples work correctly")
5858
internal func validateMacroTutorialExamples() throws {
5959
let macroTutorialFile = try Settings.resolveFilePath(
60-
"Sources/SyntaxKit/Documentation.docc/Tutorials/Creating-Macros-with-SyntaxKit.md"
60+
"Documentation.docc/Tutorials/Creating-Macros-with-SyntaxKit.md"
6161
)
6262
let results = try testHarness.validateFile(at: macroTutorialFile)
6363

Tests/SyntaxDocTests/Settings.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ internal enum Settings {
8181
return .init(fileURLWithPath: filePath)
8282
}
8383
} else {
84-
return Self.projectRoot.appendingPathComponent(filePath)
84+
#if os(Android)
85+
let resolvedPath = filePath
86+
#else
87+
let resolvedPath = "Sources/SyntaxKit/" + filePath
88+
#endif
89+
return Self.projectRoot.appendingPathComponent(resolvedPath)
8590
}
8691
}
8792
}

0 commit comments

Comments
 (0)