@testable import PureYAML import Testing @Suite("Document marker root nodes") struct DocumentMarkerNodeTests { @Test("A block scalar header on the document-marker line is recognized, not discarded") func test_blockScalarHeaderOnDocumentMarkerLine() throws { // `--- >` / `--- |`: the marker scanner used to skip the rest of the line, dropping the // block header so the body was mis-read as a plain scalar (folded, no trailing newline). #expect(try PureYAML.parse("--- >\n a\n b\n") == .string("a b\n")) #expect(try PureYAML.parse("--- |\n a\n b\n") == .string("a\nb\n")) } @Test("A scalar root node may begin on the document-marker line") func test_scalarRootNodeOnDocumentMarkerLine() throws { #expect(try PureYAML.parse("--- folded text\n") == .string("folded text")) // A node still on its own line below the marker keeps working. #expect(try PureYAML.parse("---\nplain text\n") == .string("plain text")) } }