Fix self referencing anchors should cause error (#132)

This commit is contained in:
ChristopherHX
2025-09-27 00:04:03 +02:00
committed by GitHub
parent 67f0e3d852
commit 9c2f3e9f70
2 changed files with 23 additions and 4 deletions

View File

@@ -19,6 +19,17 @@ b: &b
assert.Error(t, err)
}
func TestVerifyCycleIsInvalid2(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
a: &a
ref: *a
`), &node)
assert.NoError(t, err)
err = resolveAliases(&node)
assert.Error(t, err)
}
func TestVerifyNilAliasError(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`