(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func TestPrintError(t *testing.T) { |
| 92 | sentinel := errors.New("something went wrong") |
| 93 | |
| 94 | got := captureStderr(t, func() { |
| 95 | _ = printError(sentinel) |
| 96 | }) |
| 97 | |
| 98 | var obj map[string]string |
| 99 | if err := json.Unmarshal([]byte(strings.TrimSpace(got)), &obj); err != nil { |
| 100 | t.Fatalf("stderr is not valid JSON: %v\noutput: %s", err, got) |
| 101 | } |
| 102 | |
| 103 | if obj["error"] != sentinel.Error() { |
| 104 | t.Errorf("expected error %q, got %q", sentinel.Error(), obj["error"]) |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | func TestPrintTable(t *testing.T) { |
| 109 | headers := []string{"NAME", "STATUS"} |
nothing calls this directly
no test coverage detected