@testable import PureYAML import Testing /// A leading blank line of a block scalar (one before the first content line) carries any whitespace /// past the content indentation as content, the same as a blank line within the scalar. A `␣\t` line /// under a one-space content indent keeps the tab, so a folded scalar begins with that tab. A leading /// blank with no surplus is still just a line break. @Suite("Block scalar leading blank tab") struct BlockScalarLeadingBlankTabTests { @Test("A leading blank line keeps a tab past the content indent as content") func test_leadingBlankTab() throws { #expect(try PureYAML.parse(">\n \t\n detected\n") == .string("\t\ndetected\n")) #expect(try PureYAML.parse("|\n \t\n detected\n") == .string("\t\ndetected\n")) } @Test("A leading blank line with no surplus is just a line break") func test_leadingBlankNoSurplus() throws { #expect(try PureYAML.parse("x: |\n\n content\n") == .mapping(.init([ .init(key: "x", value: .string("\ncontent\n")), ]))) #expect(try PureYAML.parse("x: |\n \n content\n") == .mapping(.init([ .init(key: "x", value: .string("\ncontent\n")), ]))) } }