(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func TestDuTextUsesCommandOutput(t *testing.T) { |
| 17 | cmd, stdout := testDuCmd() |
| 18 | stubUsersClient(t, &mockUsersClient{ |
| 19 | getSpaceUsageFn: func() (*users.SpaceUsage, error) { |
| 20 | return individualSpaceUsage(), nil |
| 21 | }, |
| 22 | }) |
| 23 | |
| 24 | if err := du(cmd, nil); err != nil { |
| 25 | t.Fatalf("du returned error: %v", err) |
| 26 | } |
| 27 | output := stdout.String() |
| 28 | for _, want := range []string{ |
| 29 | "Used: 1.0 KiB", |
| 30 | "Type: individual", |
| 31 | "Allocated: 2.0 KiB", |
| 32 | } { |
| 33 | if !strings.Contains(output, want) { |
| 34 | t.Fatalf("stdout = %q, want %q", output, want) |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestDuJSONIndividualAllocation(t *testing.T) { |
| 40 | cmd, stdout := testDuCmd() |
nothing calls this directly
no test coverage detected