(t *testing.T)
| 302 | } |
| 303 | |
| 304 | func TestPrintEntry(t *testing.T) { |
| 305 | b := func(s string) []byte { return []byte(s) } |
| 306 | |
| 307 | testCases := []struct { |
| 308 | entry formatEntry |
| 309 | exp string |
| 310 | }{ |
| 311 | {formatEntry{}, ""}, |
| 312 | {formatEntry{head: b("abc")}, " abc"}, |
| 313 | {formatEntry{head: b("abc\nxyz")}, " abc\nxyz"}, |
| 314 | {formatEntry{details: b("def")}, " def"}, |
| 315 | {formatEntry{details: b("def\nxyz")}, " def\nxyz"}, |
| 316 | {formatEntry{head: b("abc"), details: b("def")}, " abcdef"}, |
| 317 | {formatEntry{head: b("abc\nxyz"), details: b("def")}, " abc\nxyzdef"}, |
| 318 | {formatEntry{head: b("abc"), details: b("def\n | xyz")}, " abcdef\n | xyz"}, |
| 319 | {formatEntry{head: b("abc\nxyz"), details: b("def\n | xyz")}, " abc\nxyzdef\n | xyz"}, |
| 320 | } |
| 321 | |
| 322 | for _, tc := range testCases { |
| 323 | s := state{} |
| 324 | s.printEntry(tc.entry) |
| 325 | if s.finalBuf.String() != tc.exp { |
| 326 | t.Errorf("%s: expected %q, got %q", tc.entry, tc.exp, s.finalBuf.String()) |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | func TestFormatSingleLineOutput(t *testing.T) { |
| 332 | b := func(s string) []byte { return []byte(s) } |
nothing calls this directly
no test coverage detected
searching dependent graphs…