MCPcopy
hub / github.com/stretchr/testify / NoDirExists

Function NoDirExists

assert/assertions.go:1835–1850  ·  view source on GitHub ↗

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{})

Source from the content-addressed store, hash-verified

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.
1835func 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//

Callers 4

NoDirExistsFunction · 0.92
NoDirExistsfFunction · 0.70
TestNoDirExistsFunction · 0.70
NoDirExistsMethod · 0.70

Calls 2

FailFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestNoDirExistsFunction · 0.56