@testable import PureYAML import Testing @Suite("Content after a document end marker") struct DocumentEndContentTests { @Test("Real content on a `...` marker's line is rejected") func test_contentAfterDocumentEndRejected() throws { #expect(throws: PureYAML.Parsing.ParseError.self) { try PureYAML.parse("---\nkey: value\n... invalid\n") } } @Test("A bare `...`, or one followed only by a comment, is accepted", arguments: [ "---\nx\n...\n", // nothing after the marker "---\nx\n... # comment\n", // only a comment follows "---\nx\n... \n", // only trailing spaces follow ]) func test_bareDocumentEndAccepted(_ yaml: String) throws { #expect(try PureYAML.parse(yaml) == .string("x")) } @Test("`...` not followed by a boundary is a plain scalar, not a marker") func test_dotsWithoutBoundaryIsScalar() throws { // `...junk` is not a document-end marker, so it continues the plain scalar `x`. #expect(try PureYAML.parse("---\nx\n...junk\n") == .string("x ...junk")) } }