forked from Knetic/govaluate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdummies_test.go
65 lines (53 loc) · 1.12 KB
/
dummies_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package govaluate
import (
"errors"
)
/*
Struct used to test "parameter calls".
*/
type dummyParameter struct {
String string
Int int
BoolFalse bool
Nil interface{}
Nested dummyNestedParameter
}
func (this dummyParameter) Func() string {
return "funk"
}
func (this dummyParameter) Func2() (string, error) {
return "frink", nil
}
func (this dummyParameter) FuncArgStr(arg1 string) string {
return arg1
}
func (this dummyParameter) AlwaysFail() (interface{}, error) {
return nil, errors.New("function should always fail")
}
type dummyNestedParameter struct {
Funk string
}
func (this dummyNestedParameter) Dunk(arg1 string) string {
return arg1 + "dunk"
}
var dummyParameterInstance = dummyParameter {
String: "string!",
Int: 101,
BoolFalse: false,
Nil: nil,
Nested: dummyNestedParameter {
Funk: "funkalicious",
},
}
var fooParameter = EvaluationParameter {
Name: "foo",
Value: dummyParameterInstance,
}
var fooPtrParameter = EvaluationParameter {
Name: "fooptr",
Value: &dummyParameterInstance,
}
var fooFailureParameters = map[string]interface{} {
"foo": fooParameter.Value,
"fooptr": &fooPtrParameter.Value,
}