(t *testing.T)
| 366 | } |
| 367 | |
| 368 | func TestAppendEncodedText(t *testing.T) { |
| 369 | must := func(buf []byte, x any) []byte { |
| 370 | t.Helper() |
| 371 | buf, err := appendEncodedText(buf, x) |
| 372 | if err != nil { |
| 373 | t.Fatal(err) |
| 374 | } |
| 375 | return buf |
| 376 | } |
| 377 | |
| 378 | buf := must(nil, int64(10)) |
| 379 | buf = append(buf, '\t') |
| 380 | buf = must(buf, 42.0000000001) |
| 381 | buf = append(buf, '\t') |
| 382 | buf = must(buf, "hello\tworld") |
| 383 | buf = append(buf, '\t') |
| 384 | buf = must(buf, []byte{0, 128, 255}) |
| 385 | if string(buf) != "10\t42.0000000001\thello\\tworld\t\\\\x0080ff" { |
| 386 | t.Fatal(string(buf)) |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | func TestAppendEscapedText(t *testing.T) { |
| 391 | buf := appendEscapedText(nil, "hallo\tescape") |
nothing calls this directly
no test coverage detected
searching dependent graphs…