File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
Tests/MarkdownTests/Parsing Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 11/*
22 This source file is part of the Swift.org open source project
33
4- Copyright (c) 2021 Apple Inc. and the Swift project authors
4+ Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
55 Licensed under Apache License v2.0 with Runtime Library Exception
66
77 See https://swift.org/LICENSE.txt for license information
@@ -127,7 +127,7 @@ struct PendingBlockDirective {
127127
128128 if line. text. starts ( with: " ) " ) {
129129 parseState = . argumentsEnd
130- parseArgumentsEnd ( from: line)
130+ accepted = parseArgumentsEnd ( from: line)
131131 }
132132
133133 return accepted
@@ -143,10 +143,10 @@ struct PendingBlockDirective {
143143 parseState = . contentsStart
144144 endLocation = line. location!
145145 parseContentsStart ( from: line)
146+ return true
146147 } else {
147148 return false
148149 }
149- return true
150150 }
151151
152152 /// Continue parsing from the `contentsStart` state.
Original file line number Diff line number Diff line change 11/*
22 This source file is part of the Swift.org open source project
33
4- Copyright (c) 2021-2022 Apple Inc. and the Swift project authors
4+ Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
55 Licensed under Apache License v2.0 with Runtime Library Exception
66
77 See https://swift.org/LICENSE.txt for license information
@@ -1043,4 +1043,27 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
10431043 """
10441044 XCTAssertEqual ( expected, documentation. debugDescription ( ) )
10451045 }
1046+
1047+ // FIXME: swift-testing macro for specifying the relationship between a bug and a test
1048+ // Uncomment the following code when we integrate swift-testing
1049+ // @Test("Directive MultiLine WithoutContent Parsing", .bug("#152", relationship: .verifiesFix))
1050+ func testDirectiveMultiLineWithoutContentParsing( ) throws {
1051+ let source = """
1052+ @Image(
1053+ source: " example.png " ,
1054+ alt: " Example image "
1055+ )
1056+ """
1057+
1058+ let document = Document ( parsing: source, options: . parseBlockDirectives)
1059+ _ = try XCTUnwrap ( document. child ( at: 0 ) as? BlockDirective )
1060+ let expected = #"""
1061+ Document @1:1-4:2
1062+ └─ BlockDirective @1:1-4:2 name: "Image"
1063+ ├─ Argument text segments:
1064+ | @2:1-2:25: " source: \"example.png\","
1065+ | @3:1-3:23: " alt: \"Example image\""
1066+ """#
1067+ XCTAssertEqual ( expected, document. debugDescription ( options: . printSourceLocations) )
1068+ }
10461069}
You can’t perform that action at this time.
0 commit comments