(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestValueNew(t *testing.T) { |
| 69 | c, _ := e.NewContext() |
| 70 | |
| 71 | for _, tt := range valueNewTests { |
| 72 | val, err := NewValue(tt.value) |
| 73 | if err != nil { |
| 74 | t.Errorf("NewValue('%v'): %s", tt.value, err) |
| 75 | continue |
| 76 | } |
| 77 | |
| 78 | if val == nil { |
| 79 | t.Errorf("NewValue('%v'): No error returned but value is `nil`", tt.value) |
| 80 | continue |
| 81 | } |
| 82 | |
| 83 | actual := val.Interface() |
| 84 | |
| 85 | if reflect.DeepEqual(actual, tt.expected) == false { |
| 86 | t.Errorf("NewValue('%v'): expected '%#v', actual '%#v'", tt.value, tt.expected, actual) |
| 87 | } |
| 88 | |
| 89 | val.Destroy() |
| 90 | } |
| 91 | |
| 92 | c.Destroy() |
| 93 | } |
| 94 | |
| 95 | var valueNewInvalidTests = []interface{}{ |
| 96 | uint(10), |
nothing calls this directly
no test coverage detected