@testable import PureYAML import Testing /// A tab is separation white space in YAML, so it follows the `:` mapping-value indicator as a space /// does, in both block and flow context. A `:` with no following white space at all stays plain /// scalar content (`foo:bar`), unchanged. @Suite("Mapping value tab boundary") struct MappingValueTabBoundaryTests { @Test("A block mapping value may follow the colon after a tab") func test_blockValueTab() throws { #expect(try PureYAML.parse("foo:\tbar\n") == .mapping(.init([ .init(key: "foo", value: .string("bar")), ]))) } @Test("A block sequence item mapping accepts a tab after the colon") func test_blockSequenceItemTab() throws { #expect(try PureYAML.parse("- foo:\tbar\n") == .sequence([ .mapping(.init([.init(key: "foo", value: .string("bar"))])), ])) } @Test("A flow mapping value may follow the colon after a tab") func test_flowValueTab() throws { #expect(try PureYAML.parse("{a:\tb}\n") == .mapping(.init([ .init(key: "a", value: .string("b")), ]))) } @Test("A colon with no following white space stays plain scalar content") func test_colonWithoutWhitespaceUnchanged() throws { #expect(try PureYAML.parse("foo:bar\n") == .string("foo:bar")) } }