(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func TestValue_Set(t *testing.T) { |
| 41 | testCases := []struct { |
| 42 | name string |
| 43 | stringValue func() *model.Value |
| 44 | intValue func() *model.Value |
| 45 | floatValue func() *model.Value |
| 46 | boolValue func() *model.Value |
| 47 | mapValue func() *model.Value |
| 48 | sliceValue func() *model.Value |
| 49 | nullValue func() *model.Value |
| 50 | }{ |
| 51 | { |
| 52 | name: "model constructor", |
| 53 | stringValue: func() *model.Value { |
| 54 | return model.NewStringValue("hello") |
| 55 | }, |
| 56 | intValue: func() *model.Value { |
| 57 | return model.NewIntValue(1) |
| 58 | }, |
| 59 | floatValue: func() *model.Value { |
| 60 | return model.NewFloatValue(1) |
| 61 | }, |
| 62 | boolValue: func() *model.Value { |
| 63 | return model.NewBoolValue(true) |
| 64 | }, |
| 65 | mapValue: func() *model.Value { |
| 66 | res := model.NewMapValue() |
| 67 | if err := res.SetMapKey("greeting", model.NewStringValue("hello")); err != nil { |
| 68 | t.Fatal(err) |
| 69 | } |
| 70 | return res |
| 71 | }, |
| 72 | sliceValue: func() *model.Value { |
| 73 | res := model.NewSliceValue() |
| 74 | if err := res.Append(model.NewStringValue("hello")); err != nil { |
| 75 | t.Fatal(err) |
| 76 | } |
| 77 | return res |
| 78 | }, |
| 79 | nullValue: func() *model.Value { |
| 80 | return model.NewNullValue() |
| 81 | }, |
| 82 | }, |
| 83 | { |
| 84 | name: "go types non ptr", |
| 85 | stringValue: func() *model.Value { |
| 86 | v := "hello" |
| 87 | return model.NewValue(v) |
| 88 | }, |
| 89 | intValue: func() *model.Value { |
| 90 | v := int64(1) |
| 91 | return model.NewValue(v) |
| 92 | }, |
| 93 | floatValue: func() *model.Value { |
| 94 | v := 1.0 |
| 95 | return model.NewValue(v) |
| 96 | }, |
| 97 | boolValue: func() *model.Value { |
nothing calls this directly
no test coverage detected