File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ func TestOperator_interface(t *testing.T) {
55
55
require .Equal (t , true , output )
56
56
}
57
57
58
+ type Value struct {
59
+ Int int
60
+ }
61
+
58
62
func TestOperator_Function (t * testing.T ) {
59
63
env := map [string ]interface {}{
60
64
"foo" : Value {1 },
@@ -67,15 +71,13 @@ func TestOperator_Function(t *testing.T) {
67
71
expr .Operator ("+" , "Add" ),
68
72
expr .Function ("Add" , func (args ... interface {}) (interface {}, error ) {
69
73
return args [0 ].(Value ).Int + args [1 ].(Value ).Int , nil
70
- }),
74
+ },
75
+ new (func (_ Value , __ Value ) int ),
76
+ ),
71
77
)
72
78
require .NoError (t , err )
73
79
74
80
output , err := expr .Run (program , env )
75
81
require .NoError (t , err )
76
82
require .Equal (t , 3 , output )
77
83
}
78
-
79
- type Value struct {
80
- Int int
81
- }
You can’t perform that action at this time.
0 commit comments