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

Function NoFileExists

assert/assertions.go:1800–1812  ·  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

1798// NoFileExists checks whether a file does not exist in a given path. It fails
1799// if the path points to an existing _file_ only.
1800func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
1801 if h, ok := t.(tHelper); ok {
1802 h.Helper()
1803 }
1804 info, err := os.Lstat(path)
1805 if err != nil {
1806 return true
1807 }
1808 if info.IsDir() {
1809 return true
1810 }
1811 return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...)
1812}
1813
1814// DirExists checks whether a directory exists in the given path. It also fails
1815// 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