MakeDirectoryOrFail makes a directory or fails the test, returning the path of the directory that was created.
(t *testing.T, path string)
| 134 | // MakeDirectoryOrFail makes a directory or fails the test, returning the path |
| 135 | // of the directory that was created. |
| 136 | func MakeDirectoryOrFail(t *testing.T, path string) func() { |
| 137 | if err := os.MkdirAll(path, 0755); err != nil { |
| 138 | assert.Fail(t, err.Error()) |
| 139 | } |
| 140 | |
| 141 | return func() { |
| 142 | RemoveDirectoryOrFail(t, path) |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | // WithWorkingDirectory executes the passed function within the context of |
| 147 | // the passed working directory path. If the directory does not exist, panic. |