@testable import PureYAML import Testing /// A root block scalar whose content runs to column 0 is ended by a document marker (`...` or /// `---`), not continued into it. The scalar's indentation is closed at the marker, so the stream /// stays balanced: no stray dedent and no phantom empty document afterward. @Suite("Block scalar ended by document boundary") struct BlockScalarDocumentBoundaryTests { @Test("A `...` ends a root block scalar, yielding a single document") func test_terminatedByDocumentEnd() throws { let documents = try PureYAML.parseStream("--- |\n%!PS\n...\n").map(\.value) #expect(documents == [.string("%!PS\n")]) } @Test("A `---` ends a root block scalar and starts the next document") func test_terminatedByNextDocumentStart() throws { let documents = try PureYAML.parseStream("--- |\n%!PS\n--- next\n").map(\.value) #expect(documents == [.string("%!PS\n"), .string("next")]) } @Test("Suite case W4TN: a directive, a root literal block scalar, then a comment-only document") func test_w4tnShape() throws { let yaml = "%YAML 1.2\n--- |\n%!PS-Adobe-2.0\n...\n%YAML 1.2\n---\n# Empty\n...\n" let documents = try PureYAML.parseStream(yaml).map(\.value) #expect(documents == [.string("%!PS-Adobe-2.0\n"), .null]) } }