MCPcopy Create free account
hub / github.com/deuill/go-php / TestValueNew

Function TestValueNew

engine/value_test.go:68–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func 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
95var valueNewInvalidTests = []interface{}{
96 uint(10),

Callers

nothing calls this directly

Calls 5

InterfaceMethod · 0.95
DestroyMethod · 0.95
DestroyMethod · 0.95
NewValueFunction · 0.85
NewContextMethod · 0.80

Tested by

no test coverage detected