|
1 | 1 | /* |
2 | 2 | This source file is part of the Swift.org open source project |
3 | 3 |
|
4 | | - Copyright (c) 2021-2023 Apple Inc. and the Swift project authors |
| 4 | + Copyright (c) 2021-2024 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 |
@@ -289,6 +289,56 @@ class MarkupFormatterSingleElementTests: XCTestCase { |
289 | 289 | XCTAssertEqual(expected, printed) |
290 | 290 | } |
291 | 291 |
|
| 292 | + func testPrintDoxygenPrefix() { |
| 293 | + let expectedSlash = #"\discussion Discussion"# |
| 294 | + let printedSlash = DoxygenDiscussion(children: Paragraph(Text("Discussion"))) |
| 295 | + .format(options: .init(doxygenCommandPrefix: .backslash)) |
| 296 | + XCTAssertEqual(expectedSlash, printedSlash) |
| 297 | + |
| 298 | + let expectedAt = "@discussion Discussion" |
| 299 | + let printedAt = DoxygenDiscussion(children: Paragraph(Text("Discussion"))) |
| 300 | + .format(options: .init(doxygenCommandPrefix: .at)) |
| 301 | + XCTAssertEqual(expectedAt, printedAt) |
| 302 | + } |
| 303 | + |
| 304 | + func testPrintDoxygenDiscussion() { |
| 305 | + let expected = #"\discussion Another thing."# |
| 306 | + let printed = DoxygenDiscussion(children: Paragraph(Text("Another thing."))).format() |
| 307 | + XCTAssertEqual(expected, printed) |
| 308 | + } |
| 309 | + |
| 310 | + func testPrintDoxygenDiscussionMultiline() { |
| 311 | + let expected = #""" |
| 312 | + \discussion Another thing. |
| 313 | + This is an extended discussion. |
| 314 | + """# |
| 315 | + let printed = DoxygenDiscussion(children: Paragraph( |
| 316 | + Text("Another thing."), |
| 317 | + SoftBreak(), |
| 318 | + Text("This is an extended discussion.") |
| 319 | + )).format() |
| 320 | + XCTAssertEqual(expected, printed) |
| 321 | + } |
| 322 | + |
| 323 | + func testPrintDoxygenNote() { |
| 324 | + let expected = #"\note Another thing."# |
| 325 | + let printed = DoxygenNote(children: Paragraph(Text("Another thing."))).format() |
| 326 | + XCTAssertEqual(expected, printed) |
| 327 | + } |
| 328 | + |
| 329 | + func testPrintDoxygenNoteMultiline() { |
| 330 | + let expected = #""" |
| 331 | + \note Another thing. |
| 332 | + This is an extended discussion. |
| 333 | + """# |
| 334 | + let printed = DoxygenNote(children: Paragraph( |
| 335 | + Text("Another thing."), |
| 336 | + SoftBreak(), |
| 337 | + Text("This is an extended discussion.") |
| 338 | + )).format() |
| 339 | + XCTAssertEqual(expected, printed) |
| 340 | + } |
| 341 | + |
292 | 342 | func testPrintDoxygenParameter() { |
293 | 343 | let expected = #"\param thing The thing."# |
294 | 344 | let printed = DoxygenParameter(name: "thing", children: Paragraph(Text("The thing."))).format() |
|
0 commit comments