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

Function TestNoFileExists

assert/assertions_test.go:2208–2240  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2206}
2207
2208func TestNoFileExists(t *testing.T) {
2209 mockT := new(testing.T)
2210 False(t, NoFileExists(mockT, "assertions.go"))
2211
2212 mockT = new(testing.T)
2213 True(t, NoFileExists(mockT, "non_existent_file"))
2214
2215 mockT = new(testing.T)
2216 True(t, NoFileExists(mockT, "../_codegen"))
2217
2218 var tempFiles []string
2219
2220 link, err := getTempSymlinkPath("assertions.go")
2221 if err != nil {
2222 t.Fatal("could not create temp symlink, err:", err)
2223 }
2224 tempFiles = append(tempFiles, link)
2225 mockT = new(testing.T)
2226 False(t, NoFileExists(mockT, link))
2227
2228 link, err = getTempSymlinkPath("non_existent_file")
2229 if err != nil {
2230 t.Fatal("could not create temp symlink, err:", err)
2231 }
2232 tempFiles = append(tempFiles, link)
2233 mockT = new(testing.T)
2234 False(t, NoFileExists(mockT, link))
2235
2236 errs := cleanUpTempFiles(tempFiles)
2237 if len(errs) > 0 {
2238 t.Fatal("could not clean up temporary files")
2239 }
2240}
2241
2242func getTempSymlinkPath(file string) (string, error) {
2243 link := file + "_symlink"

Callers

nothing calls this directly

Calls 5

getTempSymlinkPathFunction · 0.85
cleanUpTempFilesFunction · 0.85
FalseFunction · 0.70
NoFileExistsFunction · 0.70
TrueFunction · 0.70

Tested by

no test coverage detected