(t *testing.T)
| 528 | } |
| 529 | |
| 530 | func TestMarshalIllegalTime(t *testing.T) { |
| 531 | tests := []struct { |
| 532 | pb proto.Message |
| 533 | fail bool |
| 534 | }{ |
| 535 | {&durpb.Duration{Seconds: 1, Nanos: 0}, false}, |
| 536 | {&durpb.Duration{Seconds: -1, Nanos: 0}, false}, |
| 537 | {&durpb.Duration{Seconds: 1, Nanos: -1}, true}, |
| 538 | {&durpb.Duration{Seconds: -1, Nanos: 1}, true}, |
| 539 | {&durpb.Duration{Seconds: 315576000001}, true}, |
| 540 | {&durpb.Duration{Seconds: -315576000001}, true}, |
| 541 | {&durpb.Duration{Seconds: 1, Nanos: 1000000000}, true}, |
| 542 | {&durpb.Duration{Seconds: -1, Nanos: -1000000000}, true}, |
| 543 | {&tspb.Timestamp{Seconds: 1, Nanos: 1}, false}, |
| 544 | {&tspb.Timestamp{Seconds: 1, Nanos: -1}, true}, |
| 545 | {&tspb.Timestamp{Seconds: 1, Nanos: 1000000000}, true}, |
| 546 | } |
| 547 | for _, tt := range tests { |
| 548 | _, err := marshaler.MarshalToString(tt.pb) |
| 549 | if err == nil && tt.fail { |
| 550 | t.Errorf("marshaler.MarshalToString(%v) = _, <nil>; want _, <non-nil>", tt.pb) |
| 551 | } |
| 552 | if err != nil && !tt.fail { |
| 553 | t.Errorf("marshaler.MarshalToString(%v) = _, %v; want _, <nil>", tt.pb, err) |
| 554 | } |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | func TestMarshalJSONPBMarshaler(t *testing.T) { |
| 559 | rawJson := `{ "foo": "bar", "baz": [0, 1, 2, 3] }` |
nothing calls this directly
no test coverage detected