(t *testing.T)
| 378 | } |
| 379 | |
| 380 | func TestJSONPbEncoderFields(t *testing.T) { |
| 381 | var m runtime.JSONPb |
| 382 | for _, fixt := range fieldFixtures { |
| 383 | var buf bytes.Buffer |
| 384 | enc := m.NewEncoder(&buf) |
| 385 | if err := enc.Encode(fixt.data); err != nil { |
| 386 | t.Errorf("enc.Encode(%#v) failed with %v; want success", fixt.data, err) |
| 387 | } |
| 388 | if got, want := buf.String(), fixt.json+string(m.Delimiter()); got != want { |
| 389 | t.Errorf("enc.Encode(%#v) = %q; want %q", fixt.data, got, want) |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | m.UseEnumNumbers = true |
| 394 | buf, err := m.Marshal(examplepb.NumericEnum_ONE) |
| 395 | if err != nil { |
| 396 | t.Errorf("m.Marshal(%#v) failed with %v; want success", examplepb.NumericEnum_ONE, err) |
| 397 | } |
| 398 | if got, want := string(buf), "1"; got != want { |
| 399 | t.Errorf("m.Marshal(%#v) = %q; want %q", examplepb.NumericEnum_ONE, got, want) |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | func TestJSONPbDecoder(t *testing.T) { |
| 404 | var ( |
nothing calls this directly
no test coverage detected