NoDirExists checks whether a directory does not exist in the given path. It fails if the path points to an existing _directory_ only.
(t TestingT, path string, msgAndArgs ...interface{})
| 1742 | // NoDirExists checks whether a directory does not exist in the given path. |
| 1743 | // It fails if the path points to an existing _directory_ only. |
| 1744 | func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { |
| 1745 | if h, ok := t.(tHelper); ok { |
| 1746 | h.Helper() |
| 1747 | } |
| 1748 | info, err := os.Lstat(path) |
| 1749 | if err != nil { |
| 1750 | if os.IsNotExist(err) { |
| 1751 | return true |
| 1752 | } |
| 1753 | return true |
| 1754 | } |
| 1755 | if !info.IsDir() { |
| 1756 | return true |
| 1757 | } |
| 1758 | return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...) |
| 1759 | } |
| 1760 | |
| 1761 | // JSONEq asserts that two JSON strings are equivalent. |
| 1762 | // |
searching dependent graphs…