9
9
10
10
func TestTarget_GetOperator (t1 * testing.T ) {
11
11
harness := "Harness"
12
+ m := make (map [string ]interface {})
13
+ m ["anonymous" ] = false
12
14
type fields struct {
13
15
Identifier string
14
16
Name * string
@@ -29,7 +31,7 @@ func TestTarget_GetOperator(t1 *testing.T) {
29
31
Name * string
30
32
Anonymous bool
31
33
Attributes map [string ]interface {}
32
- }{Identifier : "harness" , Name : & harness , Anonymous : false , Attributes : nil },
34
+ }{Identifier : "harness" , Name : & harness , Anonymous : false , Attributes : m },
33
35
args : struct { attr string }{attr : "anonymous" }, want : types .Boolean (false )},
34
36
{name : "string operator" , fields : struct {
35
37
Identifier string
@@ -63,8 +65,8 @@ func TestTarget_GetOperator(t1 *testing.T) {
63
65
t := Target {
64
66
Identifier : val .fields .Identifier ,
65
67
Name : val .fields .Name ,
66
- Anonymous : val .fields .Anonymous ,
67
- Attributes : val .fields .Attributes ,
68
+ Anonymous : & val .fields .Anonymous ,
69
+ Attributes : & val .fields .Attributes ,
68
70
}
69
71
if got := t .GetOperator (val .args .attr ); ! reflect .DeepEqual (got , val .want ) {
70
72
t1 .Errorf ("GetOperator() = %v, want %v" , got , val .want )
@@ -115,8 +117,8 @@ func TestTarget_GetAttrValue(t1 *testing.T) {
115
117
t := Target {
116
118
Identifier : val .fields .Identifier ,
117
119
Name : val .fields .Name ,
118
- Anonymous : val .fields .Anonymous ,
119
- Attributes : val .fields .Attributes ,
120
+ Anonymous : & val .fields .Anonymous ,
121
+ Attributes : & val .fields .Attributes ,
120
122
}
121
123
if got := t .GetAttrValue (val .args .attr ); ! reflect .DeepEqual (got .Interface (), val .want .Interface ()) {
122
124
t1 .Errorf ("GetAttrValue() = %v, want %v" , got , val .want )
@@ -126,6 +128,8 @@ func TestTarget_GetAttrValue(t1 *testing.T) {
126
128
}
127
129
128
130
func TestTarget_GetOperator1 (t1 * testing.T ) {
131
+ m := make (map [string ]interface {})
132
+ m ["anonymous" ] = false
129
133
type fields struct {
130
134
Identifier string
131
135
Name * string
@@ -148,7 +152,7 @@ func TestTarget_GetOperator1(t1 *testing.T) {
148
152
Name * string
149
153
Anonymous bool
150
154
Attributes map [string ]interface {}
151
- }{Identifier : "john" , Name : & name , Anonymous : false , Attributes : types.JSON {}},
155
+ }{Identifier : "john" , Name : & name , Anonymous : false , Attributes : types.JSON {"anonymous" : false }},
152
156
args : struct { attr string }{attr : "anonymous" }, want : types .Boolean (false )},
153
157
{name : "string operator" , fields : struct {
154
158
Identifier string
@@ -182,8 +186,8 @@ func TestTarget_GetOperator1(t1 *testing.T) {
182
186
t := Target {
183
187
Identifier : val .fields .Identifier ,
184
188
Name : val .fields .Name ,
185
- Anonymous : val .fields .Anonymous ,
186
- Attributes : val .fields .Attributes ,
189
+ Anonymous : & val .fields .Anonymous ,
190
+ Attributes : & val .fields .Attributes ,
187
191
}
188
192
if got := t .GetOperator (val .args .attr ); ! reflect .DeepEqual (got , val .want ) {
189
193
t1 .Errorf ("GetOperator() = %v, want %v" , got , val .want )
0 commit comments