(t *testing.T)
| 329 | } |
| 330 | |
| 331 | func TestFormatSingleLineOutput(t *testing.T) { |
| 332 | b := func(s string) []byte { return []byte(s) } |
| 333 | testCases := []struct { |
| 334 | entries []formatEntry |
| 335 | exp string |
| 336 | }{ |
| 337 | {[]formatEntry{{}}, ``}, |
| 338 | {[]formatEntry{{head: b(`a`)}}, `a`}, |
| 339 | {[]formatEntry{{head: b(`a`)}, {head: b(`b`)}, {head: b(`c`)}}, `c: b: a`}, |
| 340 | {[]formatEntry{{}, {head: b(`b`)}}, `b`}, |
| 341 | {[]formatEntry{{head: b(`a`)}, {}}, `a`}, |
| 342 | {[]formatEntry{{head: b(`a`)}, {}, {head: b(`c`)}}, `c: a`}, |
| 343 | {[]formatEntry{{head: b(`a`), elideShort: true}, {head: b(`b`)}}, `b`}, |
| 344 | {[]formatEntry{{head: b("abc\ndef")}, {head: b("ghi\nklm")}}, "ghi\nklm: abc\ndef"}, |
| 345 | } |
| 346 | |
| 347 | for _, tc := range testCases { |
| 348 | s := state{entries: tc.entries} |
| 349 | s.formatSingleLineOutput() |
| 350 | if s.finalBuf.String() != tc.exp { |
| 351 | t.Errorf("%s: expected %q, got %q", tc.entries, tc.exp, s.finalBuf.String()) |
| 352 | } |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | func TestPrintEntryRedactable(t *testing.T) { |
| 357 | sm := string(redact.StartMarker()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…