RemoveDirectoryOrFail removes a directory (and its contents) or fails the test.
(t *testing.T, path string)
| 120 | |
| 121 | // RemoveDirectoryOrFail removes a directory (and its contents) or fails the test. |
| 122 | func RemoveDirectoryOrFail(t *testing.T, path string) { |
| 123 | if !DirExists(path) { |
| 124 | assert.FailNow(t, fmt.Sprintf("%s does not exist", path)) |
| 125 | } |
| 126 | |
| 127 | if err := os.RemoveAll(path); err != nil { |
| 128 | assert.Fail(t, err.Error()) |
| 129 | } else { |
| 130 | LogDebugf("removed %s\n", path) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | // MakeDirectoryOrFail makes a directory or fails the test, returning the path |
| 135 | // of the directory that was created. |