MCPcopy Create free account
hub / github.com/antonmedv/gitmal / TestFormatter_WriteQuotedName

Function TestFormatter_WriteQuotedName

pkg/gitdiff/format_test.go:8–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func 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}

Callers

nothing calls this directly

Calls 4

newFormatterFunction · 0.85
WriteQuotedNameMethod · 0.80
ErrorfMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected