@@ -34,7 +34,7 @@ func TestDecodeJson(t *testing.T) {
3434 newDecode := initNewDecodeJson (t )
3535 decodeJson := newDecode .(* DecodeJson )
3636 inputString1 := "{\" varInt\" : 12, \" varString\" :\" testString\" , \" varBool\" :false}"
37- inputString2 := "{\" varInt\" : 14, \" varString\" :\" testString2\" , \" varBool\" :true}"
37+ inputString2 := "{\" varInt\" : 14, \" varString\" :\" testString2\" , \" varBool\" :true, \" TimeReceived \" :12345 }"
3838 inputString3 := "{}"
3939 inputStringErr := "{\" varInt\" : 14, \" varString\" ,\" testString2\" , \" varBool\" :true}"
4040 var in []interface {}
@@ -49,7 +49,11 @@ func TestDecodeJson(t *testing.T) {
4949 require .Equal (t , len (out ), 3 )
5050 require .Equal (t , float64 (12 ), out [0 ]["varInt" ])
5151 require .Equal (t , "testString" , out [0 ]["varString" ])
52- require .Equal (t , bool (false ), out [0 ]["varBool" ])
52+ require .Equal (t , false , out [0 ]["varBool" ])
53+ // TimeReceived is added if it does not exist
54+ require .NotZero (t , out [0 ]["TimeReceived" ])
55+ // TimeReceived is kept if it already existed
56+ require .EqualValues (t , 12345 , out [1 ]["TimeReceived" ])
5357
5458 // TODO: Check for more complicated json structures
5559}
0 commit comments