MCPcopy Create free account
hub / github.com/segmentio/encoding / TestUnmarshalJSONLiteralError

Function TestUnmarshalJSONLiteralError

json/golang_decode_test.go:2062–2071  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2060}
2061
2062func TestUnmarshalJSONLiteralError(t *testing.T) {
2063 var t3 Time3339
2064 err := Unmarshal([]byte(`"0000-00-00T00:00:00Z"`), &t3)
2065 if err == nil {
2066 t.Fatalf("expected error; got time %v", time.Time(t3))
2067 }
2068 if !strings.Contains(err.Error(), "range") {
2069 t.Errorf("got err = %v; want out of range error", err)
2070 }
2071}
2072
2073// Test that extra object elements in an array do not result in a
2074// "data changing underfoot" error.

Callers

nothing calls this directly

Calls 2

UnmarshalFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…