Skip to content

Commit

Permalink
Add swift-testing integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye committed Sep 17, 2024
1 parent 8986fc2 commit 8990ee2
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion Tests/MarkdownTests/Parsing/BlockDirectiveParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,8 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
"""
)
}


#if !(compiler(>=6.0) && canImport(Testing))
// FIXME: swift-testing macro for specifying the relationship between a bug and a test
// Uncomment the following code when we integrate swift-testing
// @Test("Directive MultiLine WithoutContent Parsing", .bug("#152", relationship: .verifiesFix))
Expand All @@ -1238,4 +1239,34 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
"""#
XCTAssertEqual(expected, document.debugDescription(options: .printSourceLocations))
}
#endif
}

#if compiler(>=6.0) && canImport(Testing)
import Testing

struct _BlockDirectiveArgumentParserTests {
@Test(
"Directive MultiLine WithoutContent Parsing",
.bug("https://github.com/swiftlang/swift-markdown/issues" ,id: "#152", "Verify fix of #152")
)
func directiveMultiLineWithoutContentParsing() throws {
let source = #"""
@Image(
source: "example.png",
alt: "Example image"
)
"""#
let document = Document(parsing: source, options: .parseBlockDirectives)
_ = try #require(document.child(at: 0) as? BlockDirective)
let expected = #"""
Document @1:1-4:2
└─ BlockDirective @1:1-4:2 name: "Image"
├─ Argument text segments:
| @2:1-2:25: " source: \"example.png\","
| @3:1-3:23: " alt: \"Example image\""
"""#
#expect(document.debugDescription(options: .printSourceLocations) == expected)
}
}
#endif

0 comments on commit 8990ee2

Please sign in to comment.