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{})
| 1707 | // NoFileExists checks whether a file does not exist in a given path. It fails |
| 1708 | // if the path points to an existing _file_ only. |
| 1709 | func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { |
| 1710 | if h, ok := t.(tHelper); ok { |
| 1711 | h.Helper() |
| 1712 | } |
| 1713 | info, err := os.Lstat(path) |
| 1714 | if err != nil { |
| 1715 | return true |
| 1716 | } |
| 1717 | if info.IsDir() { |
| 1718 | return true |
| 1719 | } |
| 1720 | return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) |
| 1721 | } |
| 1722 | |
| 1723 | // DirExists checks whether a directory exists in the given path. It also fails |
| 1724 | // if the path is a file rather a directory or there is an error checking whether it exists. |
searching dependent graphs…