@@ -62,9 +62,12 @@ func TestPathElementSet(t *testing.T) {
6262 })
6363}
6464
65- func strptr (s string ) * string { return & s }
66- func intptr (i int ) * int { return & i }
67- func valptr (i int ) * value.Value { v := value .IntValue (i ); return & v }
65+ func strptr (s string ) * string { return & s }
66+ func intptr (i int ) * int { return & i }
67+ func valptr (i interface {}) * value.Value {
68+ v := value .NewValueInterface (i )
69+ return & v
70+ }
6871
6972func TestPathElementLess (t * testing.T ) {
7073 table := []struct {
@@ -91,7 +94,7 @@ func TestPathElementLess(t *testing.T) {
9194 }, {
9295 name : "FieldName-3" ,
9396 a : PathElement {FieldName : strptr ("capybara" )},
94- b : PathElement {Key : KeyByFields ("dog" , value . IntValue ( 3 ) )},
97+ b : PathElement {Key : KeyByFields ("dog" , 3 )},
9598 }, {
9699 name : "FieldName-4" ,
97100 a : PathElement {FieldName : strptr ("elephant" )},
@@ -102,28 +105,28 @@ func TestPathElementLess(t *testing.T) {
102105 b : PathElement {Index : intptr (5 )},
103106 }, {
104107 name : "Key-1" ,
105- a : PathElement {Key : KeyByFields ("goat" , value . IntValue ( 1 ) )},
106- b : PathElement {Key : KeyByFields ("goat" , value . IntValue ( 1 ) )},
108+ a : PathElement {Key : KeyByFields ("goat" , 1 )},
109+ b : PathElement {Key : KeyByFields ("goat" , 1 )},
107110 eq : true ,
108111 }, {
109112 name : "Key-2" ,
110- a : PathElement {Key : KeyByFields ("horse" , value . IntValue ( 1 ) )},
111- b : PathElement {Key : KeyByFields ("horse" , value . IntValue ( 2 ) )},
113+ a : PathElement {Key : KeyByFields ("horse" , 1 )},
114+ b : PathElement {Key : KeyByFields ("horse" , 2 )},
112115 }, {
113116 name : "Key-3" ,
114- a : PathElement {Key : KeyByFields ("ibex" , value . IntValue ( 1 ) )},
115- b : PathElement {Key : KeyByFields ("jay" , value . IntValue ( 1 ) )},
117+ a : PathElement {Key : KeyByFields ("ibex" , 1 )},
118+ b : PathElement {Key : KeyByFields ("jay" , 1 )},
116119 }, {
117120 name : "Key-4" ,
118- a : PathElement {Key : KeyByFields ("kite" , value . IntValue ( 1 ) )},
119- b : PathElement {Key : KeyByFields ("kite" , value . IntValue ( 1 ) , "kite-2" , value . IntValue ( 1 ) )},
121+ a : PathElement {Key : KeyByFields ("kite" , 1 )},
122+ b : PathElement {Key : KeyByFields ("kite" , 1 , "kite-2" , 1 )},
120123 }, {
121124 name : "Key-5" ,
122- a : PathElement {Key : KeyByFields ("kite" , value . IntValue ( 1 ) )},
125+ a : PathElement {Key : KeyByFields ("kite" , 1 )},
123126 b : PathElement {Value : valptr (1 )},
124127 }, {
125128 name : "Key-6" ,
126- a : PathElement {Key : KeyByFields ("kite" , value . IntValue ( 1 ) )},
129+ a : PathElement {Key : KeyByFields ("kite" , 1 )},
127130 b : PathElement {Index : intptr (5 )},
128131 }, {
129132 name : "Value-1" ,
@@ -156,15 +159,15 @@ func TestPathElementLess(t *testing.T) {
156159 tt := table [i ]
157160 if tt .eq {
158161 if tt .a .Less (tt .b ) {
159- t .Errorf ("oops, a < b: %#v, %#v" , tt .a , tt .b )
162+ t .Errorf ("oops, a < b: %#v (%v) , %#v (%v) " , tt .a , tt . a , tt . b , tt .b )
160163 }
161164 } else {
162165 if ! tt .a .Less (tt .b ) {
163- t .Errorf ("oops, a >= b: %#v, %#v" , tt .a , tt .b )
166+ t .Errorf ("oops, a >= b: %#v (%v) , %#v (%v) " , tt .a , tt . a , tt . b , tt .b )
164167 }
165168 }
166169 if tt .b .Less (tt .b ) {
167- t .Errorf ("oops, b < a: %#v, %#v" , tt .b , tt .a )
170+ t .Errorf ("oops, b < a: %#v (%v) , %#v (%v) " , tt .b , tt . b , tt . a , tt .a )
168171 }
169172 })
170173 }
0 commit comments