@testable import PureYAML import Testing @Suite("A mapping value's property indentation") struct ValuePropertyIndentationTests { @Test("An under-indented value property is rejected, whether it is the first or a later one", arguments: [ "---\nseq:\n&anchor\n- a\n- b\n", // a sole anchor at the key's indent "key: &x\n!!map\n a: b\n", // a second property (a tag) at the key's indent ]) func test_underIndentedValuePropertyRejected(_ yaml: String) throws { #expect(throws: PureYAML.Parsing.ParseError.self) { try PureYAML.parse(yaml) } } @Test("Properties indented past the key, or inline, stay valid", arguments: [ "seq:\n &a\n - x\n", // an anchor indented under the key "key: &a value\n", // an inline anchor on the value "key: &a !!str value\n", // an inline anchor and tag "key:\n &a !!map\n a: b\n", // properly indented anchor and tag "seq:\n- a\n- b\n", // a block sequence at the key's indent (no property) "key:\n &a sub: v\n", // an indented anchored key ]) func test_validValuePropertyPlacement(_ yaml: String) throws { _ = try PureYAML.parse(yaml) } }