Files
act_runner/pkg/model/anchors_test.go
ChristopherHX 79360e4ed1 fix: explode yaml anchors (#126)
* do not require code changes at several places
2025-09-13 15:46:46 +02:00

36 lines
546 B
Go

package model
import (
"testing"
"github.com/stretchr/testify/assert"
"gopkg.in/yaml.v3"
)
func TestVerifyCycleIsInvalid(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
a: &a
ref: *b
b: &b
ref: *a
`), &node)
assert.Error(t, err)
}
func TestVerifyNilAliasError(t *testing.T) {
var node yaml.Node
err := yaml.Unmarshal([]byte(`
test:
- a
- b
- c`), &node)
*node.Content[0].Content[1].Content[1] = yaml.Node{
Kind: yaml.AliasNode,
}
assert.NoError(t, err)
err = resolveAliases(&node)
assert.Error(t, err)
}