@testable import PureYAML import Testing @Suite("Directives") struct DirectiveTests { @Test("An unrecognized directive is ignored, not rejected") func test_unknownDirectiveIsIgnored() throws { // The YAML spec ignores a directive it does not recognize (with a warning), so the // document still parses. Directives must still be followed by an explicit `---`, so these // cases include one: the point here is that `%FOO` itself does not cause a rejection. #expect(try PureYAML.parse("%FOO bar baz\n---\n\"foo\"\n") == .string("foo")) #expect( try PureYAML.parse("%FOO bar\n---\nvalue: one\n") == .mapping(.init([.init(key: "value", value: .string("one"))])), ) } }