@testable import PureYAML import Testing /// A plain scalar that is an inline block sequence item value (`: - b`) stops folding when a later /// block entry returns to the sequence's own indent: those dashes form the rest of the sequence, not /// content of the first item. A block entry that is more indented than the sequence is still plain /// content of the scalar, so a wrapped value that happens to begin a line with `- ` folds in. @Suite("Inline sequence item continuation") struct InlineSequenceItemContinuationTests { @Test("An inline item scalar ends at a sibling block entry") func test_siblingEntryEndsItem() throws { // `: - b` then ` - c` is the two-item sequence `[b, c]`, not `[b - c]`. #expect(try PureYAML.parse(": - b\n - c\n") == .mapping(.init([ .init(keyNode: .string(""), value: .sequence([.string("b"), .string("c")])), ]))) } @Test("A nested compact sequence as an explicit-key value parses with tabs") func test_explicitKeyNestedSequenceWithTabs() throws { #expect(try PureYAML.parse("? a\n: -\tb\n - -\tc\n - d\n") == .mapping(.init([ .init(key: "a", value: .sequence([ .string("b"), .sequence([.string("c"), .string("d")]), ])), ]))) } @Test("A more-indented dash inside a wrapped value stays content") func test_moreIndentedDashIsContent() throws { #expect(try PureYAML.parse("- description: a query\n and 3\n - Other.\n") == .sequence([ .mapping(.init([.init(key: "description", value: .string("a query and 3 - Other."))])), ])) } }