Susumu Yata
null+****@clear*****
Mon Jul 10 12:21:59 JST 2017
Susumu Yata 2017-07-10 12:21:59 +0900 (Mon, 10 Jul 2017) New Revision: f6cec47fdfdd1ff03d4c379cd91ba5196ec23b46 https://github.com/groonga/grnci/commit/f6cec47fdfdd1ff03d4c379cd91ba5196ec23b46 Message: Add tests for zero Times. Modified files: v2/json_test.go Modified: v2/json_test.go (+7 -0) =================================================================== --- v2/json_test.go 2017-07-07 18:38:02 +0900 (074f131) +++ v2/json_test.go 2017-07-10 12:21:59 +0900 (08a8ba7) @@ -116,6 +116,10 @@ func TestAppendJSONTime(t *testing.T) { if want += "1123456789.987123"; string(buf) != want { t.Fatalf("AppendJSONTime failed: actual = %s, want = %s", buf, want) } + buf = AppendJSONTime(buf, time.Time{}) + if want += "-62135596800"; string(buf) != want { + t.Fatalf("AppendJSONTime failed: actual = %s, want = %s", buf, want) + } } func TestAppendJSONGeo(t *testing.T) { @@ -306,6 +310,9 @@ func TestEncodeJSONTime(t *testing.T) { if want, actual := "1123456789.987123", EncodeJSONTime(time.Unix(1123456789, 987123654)); actual != want { t.Fatalf("EncodeJSONTime failed: actual = %s, want = %s", actual, want) } + if want, actual := "-62135596800", EncodeJSONTime(time.Time{}); actual != want { + t.Fatalf("EncodeJSONTime failed: actual = %s, want = %s", actual, want) + } } func TestEncodeJSONGeo(t *testing.T) { -------------- next part -------------- HTML����������������������������... Download