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{})
| 1833 | // NoDirExists checks whether a directory does not exist in the given path. |
| 1834 | // It fails if the path points to an existing _directory_ only. |
| 1835 | func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { |
| 1836 | if h, ok := t.(tHelper); ok { |
| 1837 | h.Helper() |
| 1838 | } |
| 1839 | info, err := os.Lstat(path) |
| 1840 | if err != nil { |
| 1841 | if os.IsNotExist(err) { |
| 1842 | return true |
| 1843 | } |
| 1844 | return true |
| 1845 | } |
| 1846 | if !info.IsDir() { |
| 1847 | return true |
| 1848 | } |
| 1849 | return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...) |
| 1850 | } |
| 1851 | |
| 1852 | // JSONEq asserts that two JSON strings are equivalent. |
| 1853 | // |