@testable import PureYAML import Testing @Suite("Anchored mapping keys") struct AnchoredMappingKeyTests { @Test("A subsequent pair's key may carry an anchor") func test_anchoredKeyOnSubsequentPair() throws { let value = try PureYAML.parse("k: 1\n&b key2: 2\n") #expect(value == .mapping(.init([ .init(key: "k", value: .int(1)), .init(key: "key2", value: .int(2)), ]))) } @Test("An anchored key on the first pair still parses") func test_anchoredKeyOnFirstPair() throws { #expect(try PureYAML.parse("&a c: 3\n") == .mapping(.init([.init(key: "c", value: .int(3))]))) } }