Added some more tests to bump coverage back up.

Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2023-07-16 08:54:03 -04:00
committed by quobix
parent 25d8de9b0e
commit 3ebc702deb
2 changed files with 69 additions and 0 deletions

View File

@@ -802,6 +802,33 @@ thangs: *anchorA`
}
func TestNodeAlias_Nil(t *testing.T) {
ref := NodeAlias(nil)
assert.Nil(t, ref)
}
func TestNodeAlias_IsNodeAlias_Nil(t *testing.T) {
_, isAlias := IsNodeAlias(nil)
assert.False(t, isAlias)
}
func TestNodeAlias_IsNodeAlias_False(t *testing.T) {
yml := `things:
- Stuff
- Junk
thangs: none`
var node yaml.Node
_ = yaml.Unmarshal([]byte(yml), &node)
_, isAlias := IsNodeAlias(node.Content[0].Content[3])
assert.False(t, isAlias)
}
func TestCheckForMergeNodes(t *testing.T) {
yml := `x-common-definitions:
@@ -850,6 +877,15 @@ func TestIsNodeRefValue_False(t *testing.T) {
assert.Empty(t, val)
}
func TestIsNodeRefValue_Nil(t *testing.T) {
ref, node, val := IsNodeRefValue(nil)
assert.False(t, ref)
assert.Nil(t, node)
assert.Empty(t, val)
}
func TestCheckEnumForDuplicates_Success(t *testing.T) {
yml := "- yes\n- no\n- crisps"
var rootNode yaml.Node