(t *testing.T)
| 526 | } |
| 527 | |
| 528 | func TestReadZCString(t *testing.T) { |
| 529 | var buf bytes.Buffer |
| 530 | en := NewWriter(&buf) |
| 531 | |
| 532 | tests := []string{"", "hello", "here's another string......"} |
| 533 | |
| 534 | for i, v := range tests { |
| 535 | buf.Reset() |
| 536 | en.WriteString(v) |
| 537 | en.Flush() |
| 538 | |
| 539 | out, left, err := ReadStringZC(buf.Bytes()) |
| 540 | if err != nil { |
| 541 | t.Errorf("test case %d: %s", i, err) |
| 542 | } |
| 543 | if len(left) != 0 { |
| 544 | t.Errorf("expected 0 bytes left; found %d", len(left)) |
| 545 | } |
| 546 | if string(out) != v { |
| 547 | t.Errorf("%q in; %q out", v, out) |
| 548 | } |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | func TestReadStringBytes(t *testing.T) { |
| 553 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected
searching dependent graphs…