(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func TestDuJSONErrorWritesNoOutput(t *testing.T) { |
| 110 | cmd, stdout := testDuCmd() |
| 111 | setDuOutputJSON(t, cmd) |
| 112 | stubUsersClient(t, &mockUsersClient{ |
| 113 | getSpaceUsageFn: func() (*users.SpaceUsage, error) { |
| 114 | return nil, errors.New("du failed") |
| 115 | }, |
| 116 | }) |
| 117 | |
| 118 | if err := du(cmd, nil); err == nil { |
| 119 | t.Fatal("expected du error") |
| 120 | } |
| 121 | if got := stdout.String(); got != "" { |
| 122 | t.Fatalf("stdout = %q, want empty output on error", got) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func TestDuCommandSupportsStructuredOutput(t *testing.T) { |
| 127 | if !commandSupportsStructuredOutput(duCmd) { |
nothing calls this directly
no test coverage detected