(t *testing.T)
| 375 | } |
| 376 | |
| 377 | func TestFormatValue(t *testing.T) { |
| 378 | examples := []struct { |
| 379 | value interface{} |
| 380 | want string |
| 381 | }{ |
| 382 | {"hello", "hello"}, |
| 383 | {"hello world", `"hello world"`}, |
| 384 | {1.5, "1.5"}, |
| 385 | {true, "true"}, |
| 386 | {errors.New("this is an error"), `"this is an error"`}, |
| 387 | {[]byte{'a', 'b', 'c'}, `"[97 98 99]"`}, |
| 388 | {bytes.NewBuffer([]byte{'a', 'b', 'c'}), "abc"}, |
| 389 | {"a b\"c\nd;e\tf龜g", `"a b\"c\nd;e\tf龜g"`}, |
| 390 | } |
| 391 | |
| 392 | for i, ex := range examples { |
| 393 | t.Log("Example", i) |
| 394 | got := formatValue(ex.value) |
| 395 | if got != ex.want { |
| 396 | t.Errorf("formatKey(%#v) = %q want %q", ex.value, got, ex.want) |
| 397 | } |
| 398 | } |
| 399 | } |
nothing calls this directly
no test coverage detected