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{})
| 1750 | // NoFileExists checks whether a file does not exist in a given path. It fails |
| 1751 | // if the path points to an existing _file_ only. |
| 1752 | func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { |
| 1753 | if h, ok := t.(tHelper); ok { |
| 1754 | h.Helper() |
| 1755 | } |
| 1756 | info, err := os.Lstat(path) |
| 1757 | if err != nil { |
| 1758 | return true |
| 1759 | } |
| 1760 | if info.IsDir() { |
| 1761 | return true |
| 1762 | } |
| 1763 | return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) |
| 1764 | } |
| 1765 | |
| 1766 | // DirExists checks whether a directory exists in the given path. It also fails |
| 1767 | // if the path is a file rather a directory or there is an error checking whether it exists. |