mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-08 12:37:49 +00:00
Bumped coverage back up for model_builder
Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user