(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestTable_WithHeaderFormatter(t *testing.T) { |
| 46 | t.Parallel() |
| 47 | |
| 48 | uppercase := func(f string, v ...interface{}) string { |
| 49 | return strings.ToUpper(fmt.Sprintf(f, v...)) |
| 50 | } |
| 51 | buf := bytes.Buffer{} |
| 52 | |
| 53 | tbl := New("foo", "bar").WithWriter(&buf).WithHeaderFormatter(uppercase) |
| 54 | tbl.Print() |
| 55 | out := buf.String() |
| 56 | |
| 57 | assert.Contains(t, out, "FOO") |
| 58 | assert.Contains(t, out, "BAR") |
| 59 | |
| 60 | buf.Reset() |
| 61 | tbl.WithHeaderFormatter(nil).Print() |
| 62 | out = buf.String() |
| 63 | |
| 64 | assert.Contains(t, out, "foo") |
| 65 | assert.Contains(t, out, "bar") |
| 66 | } |
| 67 | |
| 68 | func TestTable_WithFirstColumnFormatter(t *testing.T) { |
| 69 | t.Parallel() |
nothing calls this directly
no test coverage detected