@testable import PureYAML import Testing /// Plain scalar line folding strips white space, including tabs, around continuation lines: a tab is /// not indentation, so the leading tab of a continuation line folds away, and a line of only white /// space (even one holding a tab) is an empty line that folds to a line break, not a space. @Suite("Plain scalar tab folding") struct PlainScalarTabFoldingTests { @Test("A leading tab on a continuation line folds away") func test_leadingTabFoldsToSpace() throws { #expect(try PureYAML.parse("1st non-empty\n\n 2nd non-empty \n\t3rd non-empty\n") == .string("1st non-empty\n2nd non-empty 3rd non-empty")) } @Test("A whitespace-only line holding a tab is an empty line, folding to a line break") func test_whitespaceOnlyTabLineIsBlank() throws { #expect(try PureYAML.parse("key:\n value\n with\n \t\n tabs\n") == .mapping(.init([ .init(key: "key", value: .string("value with\ntabs")), ]))) } @Test("A tab after the indentation of a continuation line folds away") func test_tabAfterIndentFolds() throws { #expect(try PureYAML.parse("x:\n - x\n \tx\n") == .mapping(.init([ .init(key: "x", value: .sequence([.string("x x")])), ]))) } }