@testable import PureYAML import Testing @Suite("Directives after a document-end marker") struct DirectiveAfterDocumentEndTests { @Test("A directive after `...` begins the next document") func test_directiveAfterDocumentEndStartsNextDocument() throws { let docs = try PureYAML.parseStream("a\n...\n%YAML 1.2\n---\nb\n") #expect(docs.count == 2) #expect(docs[0].value == .string("a")) #expect(docs[1].value == .string("b")) } @Test("A %TAG directive may be repeated for each document after `...`") func test_repeatedTagDirectivePerDocument() throws { let docs = try PureYAML.parseStream( "%TAG !m! !my-\n--- !m!light fluorescent\n...\n%TAG !m! !my-\n--- !m!light green\n", ) #expect(docs.count == 2) } @Test("A directive after `...` still requires its own document start") func test_directiveAfterDocumentEndStillRequiresDocument() throws { #expect(throws: PureYAML.Parsing.ParseError.self) { try PureYAML.parseStream("a\n...\n%YAML 1.2\n") } } }