(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func TestFormatter_WriteQuotedName(t *testing.T) { |
| 9 | tests := []struct { |
| 10 | Input string |
| 11 | Expected string |
| 12 | }{ |
| 13 | {"noquotes.txt", `noquotes.txt`}, |
| 14 | {"no quotes.txt", `no quotes.txt`}, |
| 15 | {"new\nline", `"new\nline"`}, |
| 16 | {"escape\x1B null\x00", `"escape\033 null\000"`}, |
| 17 | {"snowman \u2603 snowman", `"snowman \342\230\203 snowman"`}, |
| 18 | {"\"already quoted\"", `"\"already quoted\""`}, |
| 19 | } |
| 20 | |
| 21 | for _, test := range tests { |
| 22 | var b strings.Builder |
| 23 | newFormatter(&b).WriteQuotedName(test.Input) |
| 24 | if b.String() != test.Expected { |
| 25 | t.Errorf("expected %q, got %q", test.Expected, b.String()) |
| 26 | } |
| 27 | } |
| 28 | } |
nothing calls this directly
no test coverage detected