File tree 2 files changed +27
-4
lines changed
Tests/MarkdownTests/Parsing 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
- Copyright (c) 2021 Apple Inc. and the Swift project authors
4
+ Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See https://swift.org/LICENSE.txt for license information
@@ -127,7 +127,7 @@ struct PendingBlockDirective {
127
127
128
128
if line. text. starts ( with: " ) " ) {
129
129
parseState = . argumentsEnd
130
- parseArgumentsEnd ( from: line)
130
+ accepted = parseArgumentsEnd ( from: line)
131
131
}
132
132
133
133
return accepted
@@ -143,10 +143,10 @@ struct PendingBlockDirective {
143
143
parseState = . contentsStart
144
144
endLocation = line. location!
145
145
parseContentsStart ( from: line)
146
+ return true
146
147
} else {
147
148
return false
148
149
}
149
- return true
150
150
}
151
151
152
152
/// Continue parsing from the `contentsStart` state.
Original file line number Diff line number Diff line change 1
1
/*
2
2
This source file is part of the Swift.org open source project
3
3
4
- Copyright (c) 2021-2022 Apple Inc. and the Swift project authors
4
+ Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
5
5
Licensed under Apache License v2.0 with Runtime Library Exception
6
6
7
7
See https://swift.org/LICENSE.txt for license information
@@ -1043,4 +1043,27 @@ class BlockDirectiveArgumentParserTests: XCTestCase {
1043
1043
"""
1044
1044
XCTAssertEqual ( expected, documentation. debugDescription ( ) )
1045
1045
}
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
+ }
1046
1069
}
You can’t perform that action at this time.
0 commit comments