MCPcopy Create free account
hub / github.com/stretchr/testify / NoFileExists

Function NoFileExists

assert/assertions.go:1752–1764  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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.
1752func 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.

Callers 4

NoFileExistsFunction · 0.92
NoFileExistsfFunction · 0.70
TestNoFileExistsFunction · 0.70
NoFileExistsMethod · 0.70

Calls 2

FailFunction · 0.70
HelperMethod · 0.65

Tested by 1

TestNoFileExistsFunction · 0.56