(t *testing.T)
| 376 | } |
| 377 | |
| 378 | func TestReadJSONProtocolString(t *testing.T) { |
| 379 | thetype := "string" |
| 380 | for _, value := range STRING_VALUES { |
| 381 | trans := NewTMemoryBuffer() |
| 382 | p := NewTJSONProtocol(trans) |
| 383 | trans.WriteString(jsonQuote(value)) |
| 384 | trans.Flush(context.Background()) |
| 385 | s := trans.String() |
| 386 | v, e := p.ReadString(context.Background()) |
| 387 | if e != nil { |
| 388 | t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) |
| 389 | } |
| 390 | if v != value { |
| 391 | t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) |
| 392 | } |
| 393 | v1 := new(string) |
| 394 | if err := json.Unmarshal([]byte(s), v1); err != nil || *v1 != value { |
| 395 | t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v1) |
| 396 | } |
| 397 | trans.Reset() |
| 398 | trans.Close() |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | func TestWriteJSONProtocolBinary(t *testing.T) { |
| 403 | thetype := "binary" |
nothing calls this directly
no test coverage detected