@@ -150,20 +150,20 @@ func AssertObject(t *testing.T, expectedKey string, expectedValue interface{}, a
150150 default :
151151 fmt .Println ("**** Compairing Key { " + expectedKey + " } ****" )
152152
153- // If expected is a (non-empty, valid) JSON string, compare as JSON
154- if es , ok := expectedValue .(string ); ok && isValidJSONStr (es ) {
155- as , ok2 := toJSONString (actualValue )
156- if ! ok2 || ! isValidJSONStr (as ) {
157- // Decide what you want here: strict fail or fallback to raw equality
158- require .Failf (t ,
159- "invalid actual JSON" ,
160- "key %s: expected valid JSON, but actual isn't valid JSON/stringifies \n actual: %#v" ,
161- expectedKey , actualValue )
162- }
163- require .JSONEqf (t , es , as , "key %s: JSON mismatch" , expectedKey )
164- } else {
165- assert .Equal (t , expectedValue , actualValue , fmt .Sprintf ("Mismatch between actual value and expected values for key %v." , expectedKey ))
166- }
153+ // If expected is a (non-empty, valid) JSON string, compare as JSON
154+ if es , ok := expectedValue .(string ); ok && isValidJSONStr (es ) {
155+ as , ok2 := toJSONString (actualValue )
156+ if ! ok2 || ! isValidJSONStr (as ) {
157+ // Decide what you want here: strict fail or fallback to raw equality
158+ require .Failf (t ,
159+ "invalid actual JSON" ,
160+ "key %s: expected valid JSON, but actual isn't valid JSON/stringifies \n actual: %#v" ,
161+ expectedKey , actualValue )
162+ }
163+ require .JSONEqf (t , es , as , "key %s: JSON mismatch" , expectedKey )
164+ } else {
165+ assert .Equal (t , expectedValue , actualValue , fmt .Sprintf ("Mismatch between actual value and expected values for key %v." , expectedKey ))
166+ }
167167 }
168168}
169169
0 commit comments