(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func TestTable_WithFirstColumnFormatter(t *testing.T) { |
| 69 | t.Parallel() |
| 70 | |
| 71 | uppercase := func(f string, v ...interface{}) string { |
| 72 | return strings.ToUpper(fmt.Sprintf(f, v...)) |
| 73 | } |
| 74 | |
| 75 | buf := bytes.Buffer{} |
| 76 | |
| 77 | tbl := New("foo", "bar").WithWriter(&buf).WithFirstColumnFormatter(uppercase).AddRow("fizz", "buzz") |
| 78 | tbl.Print() |
| 79 | out := buf.String() |
| 80 | |
| 81 | config.Debug = true |
| 82 | config.Debugf("%s", out) |
| 83 | |
| 84 | assert.Contains(t, out, "foo") |
| 85 | assert.Contains(t, out, "bar") |
| 86 | assert.Contains(t, out, "FIZZ") |
| 87 | assert.Contains(t, out, "buzz") |
| 88 | |
| 89 | buf.Reset() |
| 90 | tbl.WithFirstColumnFormatter(nil).Print() |
| 91 | out = buf.String() |
| 92 | |
| 93 | assert.Contains(t, out, "fizz") |
| 94 | assert.Contains(t, out, "buzz") |
| 95 | } |
| 96 | |
| 97 | func TestTable_WithPadding(t *testing.T) { |
| 98 | t.Parallel() |
nothing calls this directly
no test coverage detected