@testable import PureYAML import Testing @Suite("A tagged zero-indent block sequence is terminated by a sibling mapping key") struct TaggedZeroIndentSequenceTests { /// yaml-test-suite 57H4: a block sequence value carrying an inline tag (`sequence: !!seq` then /// `- entry` at the key's column) is a zero-indent sequence whose entries sit at the mapping /// key's indentation. A following sibling key (`mapping:`) ends the sequence rather than mixing /// into it, the same as an untagged zero-indent sequence. @Test("A tagged zero-indent sequence ends at the next sibling key") func test_taggedZeroIndentSequence() throws { let root = try requireMapping(PureYAML.parse( "sequence: !!seq\n- entry\n- !!seq\n - nested\nmapping: !!map\n foo: bar\n", )) #expect(root?["sequence"] == .sequence([.string("entry"), .sequence([.string("nested")])])) let mapping = try requireMapping(#require(root?["mapping"])) #expect(mapping?["foo"] == .string("bar")) } /// The untagged zero-indent sequence followed by a sibling key keeps working unchanged. @Test("An untagged zero-indent sequence still ends at the next sibling key") func test_untaggedZeroIndentSequence() throws { let root = try requireMapping(PureYAML.parse("seq:\n- a\n- b\nother: x\n")) #expect(root?["seq"] == .sequence([.string("a"), .string("b")])) #expect(root?["other"] == .string("x")) } }