diff --git a/datamodel/low/model_builder_test.go b/datamodel/low/model_builder_test.go index b33d0cc..5a8eb77 100644 --- a/datamodel/low/model_builder_test.go +++ b/datamodel/low/model_builder_test.go @@ -337,11 +337,6 @@ func TestSetField_Default_Helper(t *testing.T) { 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]] } @@ -361,6 +356,26 @@ func TestHandleSlicesOfInts(t *testing.T) { assert.Equal(t, 1.234, ins.Thing.Value[1].Value) } +func TestHandleSlicesOfBools(t *testing.T) { + type internal struct { + Thing NodeReference[[]ValueReference[any]] + } + + yml := `thing: + - true + - false` + + 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, true, ins.Thing.Value[0].Value) + assert.Equal(t, false, ins.Thing.Value[1].Value) +} + func TestSetField_Ignore(t *testing.T) { type Complex struct {