@@ -75,6 +75,8 @@ func TestTarget_GetOperator(t1 *testing.T) {
75
75
76
76
func TestTarget_GetAttrValue (t1 * testing.T ) {
77
77
name := "John"
78
+ identifier := "john"
79
+
78
80
type fields struct {
79
81
Identifier string
80
82
Name * string
@@ -95,17 +97,17 @@ func TestTarget_GetAttrValue(t1 *testing.T) {
95
97
Name * string
96
98
Anonymous bool
97
99
Attributes map [string ]interface {}
98
- }{Identifier : "john" , Name : & name , Anonymous : false , Attributes : types.JSON {}},
99
- args : struct { attr string }{attr : "identifier" }, want : reflect .ValueOf ("john" )},
100
+ }{Identifier : identifier , Name : & name , Anonymous : false , Attributes : types.JSON {}},
101
+ args : struct { attr string }{attr : "identifier" }, want : reflect .ValueOf (identifier )},
100
102
{name : "check attributes" , fields : struct {
101
103
Identifier string
102
104
Name * string
103
105
Anonymous bool
104
106
Attributes map [string ]interface {}
105
107
}{Identifier : "john" , Name : & name , Anonymous : false , Attributes : types.JSON {
106
-
108
+ "email" : email ,
107
109
}},
108
- args :
struct {
attr string }{
attr :
"email" },
want :
reflect .
ValueOf (
"[email protected] " )},
110
+ args : struct { attr string }{attr : "email" }, want : reflect .ValueOf (email )},
109
111
}
110
112
for _ , tt := range tests {
111
113
val := tt
@@ -116,7 +118,7 @@ func TestTarget_GetAttrValue(t1 *testing.T) {
116
118
Anonymous : val .fields .Anonymous ,
117
119
Attributes : val .fields .Attributes ,
118
120
}
119
- if got := t .GetAttrValue (val .args .attr ); got == val .want {
121
+ if got := t .GetAttrValue (val .args .attr ); ! reflect . DeepEqual ( got . Interface (), val .want . Interface ()) {
120
122
t1 .Errorf ("GetAttrValue() = %v, want %v" , got , val .want )
121
123
}
122
124
})
0 commit comments