NoFileExists checks whether a file does not exist in a given path. It fails if the path points to an existing _file_ only.
(t TestingT, path string, msgAndArgs ...interface{})
| 1798 | // NoFileExists checks whether a file does not exist in a given path. It fails |
| 1799 | // if the path points to an existing _file_ only. |
| 1800 | func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { |
| 1801 | if h, ok := t.(tHelper); ok { |
| 1802 | h.Helper() |
| 1803 | } |
| 1804 | info, err := os.Lstat(path) |
| 1805 | if err != nil { |
| 1806 | return true |
| 1807 | } |
| 1808 | if info.IsDir() { |
| 1809 | return true |
| 1810 | } |
| 1811 | return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) |
| 1812 | } |
| 1813 | |
| 1814 | // DirExists checks whether a directory exists in the given path. It also fails |
| 1815 | // if the path is a file rather a directory or there is an error checking whether it exists. |