(t *testing.T)
| 106 | } |
| 107 | |
| 108 | func TestPrintTable(t *testing.T) { |
| 109 | headers := []string{"NAME", "STATUS"} |
| 110 | rows := [][]string{ |
| 111 | {"pve01", "online"}, |
| 112 | {"pve02", "offline"}, |
| 113 | } |
| 114 | |
| 115 | got := captureStdout(t, func() { |
| 116 | printTable(headers, rows) |
| 117 | }) |
| 118 | |
| 119 | for _, want := range []string{"NAME", "STATUS", "pve01", "online", "pve02", "offline"} { |
| 120 | if !strings.Contains(got, want) { |
| 121 | t.Errorf("output missing %q\nfull output:\n%s", want, got) |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func TestFormatBytes(t *testing.T) { |
| 127 | cases := []struct { |
nothing calls this directly
no test coverage detected