@@ -91,6 +91,65 @@ class DoxygenCommandParserTests: XCTestCase {
91
91
XCTAssertEqual ( document. debugDescription ( ) , expectedDump)
92
92
}
93
93
94
+ func testParseIndentedDescription( ) {
95
+ let source = """
96
+ @param thing
97
+ The thing.
98
+ """
99
+
100
+ let document = Document ( parsing: source, options: parseOptions)
101
+
102
+ let expectedDump = """
103
+ Document
104
+ └─ DoxygenParameter parameter: thing
105
+ └─ Paragraph
106
+ └─ Text " The thing. "
107
+ """
108
+ XCTAssertEqual ( document. debugDescription ( ) , expectedDump)
109
+ }
110
+
111
+ func testParseMultilineIndentedDescription( ) {
112
+ let source = """
113
+ @param thing The thing.
114
+ This is the thing that is messed with.
115
+ """
116
+
117
+ let document = Document ( parsing: source, options: parseOptions)
118
+
119
+ let expectedDump = """
120
+ Document
121
+ └─ DoxygenParameter parameter: thing
122
+ └─ Paragraph
123
+ ├─ Text " The thing. "
124
+ ├─ SoftBreak
125
+ └─ Text " This is the thing that is messed with. "
126
+ """
127
+ XCTAssertEqual ( document. debugDescription ( ) , expectedDump)
128
+ }
129
+
130
+ func testParseWithIndentedAtSign( ) {
131
+ let source = """
132
+ Method description.
133
+
134
+ @param thing The thing.
135
+ This is the thing that is messed with.
136
+ """
137
+
138
+ let document = Document ( parsing: source, options: parseOptions)
139
+
140
+ let expectedDump = """
141
+ Document
142
+ ├─ Paragraph
143
+ │ └─ Text " Method description. "
144
+ └─ DoxygenParameter parameter: thing
145
+ └─ Paragraph
146
+ ├─ Text " The thing. "
147
+ ├─ SoftBreak
148
+ └─ Text " This is the thing that is messed with. "
149
+ """
150
+ XCTAssertEqual ( document. debugDescription ( ) , expectedDump)
151
+ }
152
+
94
153
func testBreakDescriptionWithBlankLine( ) {
95
154
let source = """
96
155
@param thing The thing.
@@ -188,7 +247,6 @@ class DoxygenCommandParserTests: XCTestCase {
188
247
189
248
let document = Document ( parsing: source, options: parseOptions)
190
249
191
- // FIXME: The source location for the first description line is wrong
192
250
let expectedDump = """
193
251
Document @1:1-2:39
194
252
└─ DoxygenParameter @1:1-2:39 parameter: thing
@@ -200,6 +258,48 @@ class DoxygenCommandParserTests: XCTestCase {
200
258
XCTAssertEqual ( document. debugDescription ( options: . printSourceLocations) , expectedDump)
201
259
}
202
260
261
+ func testSourceLocationsWithIndentation( ) {
262
+ let source = """
263
+ @param thing The thing.
264
+ This is the thing that is messed with.
265
+ """
266
+
267
+ let document = Document ( parsing: source, options: parseOptions)
268
+
269
+ let expectedDump = """
270
+ Document @1:1-2:43
271
+ └─ DoxygenParameter @1:1-2:43 parameter: thing
272
+ └─ Paragraph @1:14-2:43
273
+ ├─ Text @1:14-1:24 " The thing. "
274
+ ├─ SoftBreak
275
+ └─ Text @2:5-2:43 " This is the thing that is messed with. "
276
+ """
277
+ XCTAssertEqual ( document. debugDescription ( options: . printSourceLocations) , expectedDump)
278
+ }
279
+
280
+ func testSourceLocationsWithIndentedAtSign( ) {
281
+ let source = """
282
+ Method description.
283
+
284
+ @param thing The thing.
285
+ This is the thing that is messed with.
286
+ """
287
+
288
+ let document = Document ( parsing: source, options: parseOptions)
289
+
290
+ let expectedDump = """
291
+ Document @1:1-4:43
292
+ ├─ Paragraph @1:1-1:20
293
+ │ └─ Text @1:1-1:20 " Method description. "
294
+ └─ DoxygenParameter @3:2-4:43 parameter: thing
295
+ └─ Paragraph @3:15-4:43
296
+ ├─ Text @3:15-3:25 " The thing. "
297
+ ├─ SoftBreak
298
+ └─ Text @4:5-4:43 " This is the thing that is messed with. "
299
+ """
300
+ XCTAssertEqual ( document. debugDescription ( options: . printSourceLocations) , expectedDump)
301
+ }
302
+
203
303
func testDoesNotParseWithoutOption( ) {
204
304
do {
205
305
let source = """
0 commit comments