@testable import PureYAML import Testing @Suite("Node properties may span indented lines above a further-indented node") struct MultilinePropertyIndentTests { /// yaml-test-suite BU8L: an inline anchor and a tag on the next indented line are both properties /// of a mapping that is indented further still (`key: &anchor` / ` !!map` / ` a: b`). The parser /// descends through the deeper indent to the node rather than rejecting it as a missing node. @Test("An anchor then an indented tag attach to a further-indented mapping") func test_anchorThenTagOnDeeperMapping() throws { let root = try requireMapping(PureYAML.parse("key: &anchor\n !!map\n a: b\n")) let value = try requireMapping(#require(root?["key"])) #expect(value?["a"] == .string("b")) } /// The same anchored mapping is reachable through an alias, confirming the anchor registered with /// the nested mapping and not with an empty node. @Test("The anchor on the spanned properties registers the nested mapping") func test_spannedPropertyAnchorRegisters() throws { let root = try requireMapping(PureYAML.parse("key: &anchor\n !!map\n a: b\nref: *anchor\n")) let aliased = try requireMapping(#require(root?["ref"])) #expect(aliased?["a"] == .string("b")) } }