(t *testing.T)
| 352 | } |
| 353 | |
| 354 | func TestWriteJSONProtocolString(t *testing.T) { |
| 355 | thetype := "string" |
| 356 | trans := NewTMemoryBuffer() |
| 357 | p := NewTJSONProtocol(trans) |
| 358 | for _, value := range STRING_VALUES { |
| 359 | if e := p.WriteString(context.Background(), value); e != nil { |
| 360 | t.Fatalf("Unable to write %s value %v due to error: %s", thetype, value, e.Error()) |
| 361 | } |
| 362 | if e := p.Flush(context.Background()); e != nil { |
| 363 | t.Fatalf("Unable to write %s value %v due to error flushing: %s", thetype, value, e.Error()) |
| 364 | } |
| 365 | s := trans.String() |
| 366 | if s[0] != '"' || s[len(s)-1] != '"' { |
| 367 | t.Fatalf("Bad value for %s '%v', wrote '%v', expected: %v", thetype, value, s, fmt.Sprint("\"", value, "\"")) |
| 368 | } |
| 369 | v := new(string) |
| 370 | if err := json.Unmarshal([]byte(s), v); err != nil || *v != value { |
| 371 | t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, *v) |
| 372 | } |
| 373 | trans.Reset() |
| 374 | } |
| 375 | trans.Close() |
| 376 | } |
| 377 | |
| 378 | func TestReadJSONProtocolString(t *testing.T) { |
| 379 | thetype := "string" |
nothing calls this directly
no test coverage detected