Added in high document API

filling out documentation, looking at DX and how to consume things, re-shuffling and cleaning house.
This commit is contained in:
Dave Shanley
2022-09-13 08:39:38 -04:00
parent d2b974829d
commit 647541cc77
11 changed files with 682 additions and 503 deletions

View File

@@ -659,3 +659,27 @@ func TestIsNodeRefValue_False(t *testing.T) {
assert.Nil(t, node)
assert.Empty(t, val)
}
func TestCheckEnumForDuplicates_Success(t *testing.T) {
yml := "- yes\n- no\n- crisps"
var rootNode yaml.Node
yaml.Unmarshal([]byte(yml), &rootNode)
assert.Len(t, CheckEnumForDuplicates(rootNode.Content[0].Content), 0)
}
func TestCheckEnumForDuplicates_Fail(t *testing.T) {
yml := "- yes\n- no\n- crisps\n- no"
var rootNode yaml.Node
yaml.Unmarshal([]byte(yml), &rootNode)
assert.Len(t, CheckEnumForDuplicates(rootNode.Content[0].Content), 1)
}
func TestCheckEnumForDuplicates_FailMultiple(t *testing.T) {
yml := "- yes\n- no\n- crisps\n- no\n- rice\n- yes\n- no"
var rootNode yaml.Node
yaml.Unmarshal([]byte(yml), &rootNode)
assert.Len(t, CheckEnumForDuplicates(rootNode.Content[0].Content), 3)
}