Bumped coverage back up for model_builder

Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
Dave Shanley
2023-04-30 08:48:23 -04:00
parent 1f9a8bd185
commit f2104552f4

View File

@@ -335,6 +335,31 @@ func TestSetField_Default_Helper(t *testing.T) {
assert.Equal(t, 0, ins.Thing.thing)
}
func TestHandleSlicesOfInts(t *testing.T) {
type cake struct {
thing int
}
// this should be ignored, no custom objects in here my friend.
type internal struct {
Thing NodeReference[[]ValueReference[any]]
}
yml := `thing:
- 5
- 1.234`
ins := new(internal)
var rootNode yaml.Node
mErr := yaml.Unmarshal([]byte(yml), &rootNode)
assert.NoError(t, mErr)
try := BuildModel(rootNode.Content[0], ins)
assert.NoError(t, try)
assert.Equal(t, 0, ins.Thing)
}
func TestSetField_Ignore(t *testing.T) {
type Complex struct {