MCPcopy
hub / github.com/expr-lang/expr / TestNoFileExists

Function TestNoFileExists

internal/testify/assert/assertions_test.go:2079–2111  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2077}
2078
2079func TestNoFileExists(t *testing.T) {
2080 mockT := new(testing.T)
2081 False(t, NoFileExists(mockT, "assertions.go"))
2082
2083 mockT = new(testing.T)
2084 True(t, NoFileExists(mockT, "non_existent_file"))
2085
2086 mockT = new(testing.T)
2087 True(t, NoFileExists(mockT, "../_codegen"))
2088
2089 var tempFiles []string
2090
2091 link, err := getTempSymlinkPath("assertions.go")
2092 if err != nil {
2093 t.Fatal("could not create temp symlink, err:", err)
2094 }
2095 tempFiles = append(tempFiles, link)
2096 mockT = new(testing.T)
2097 False(t, NoFileExists(mockT, link))
2098
2099 link, err = getTempSymlinkPath("non_existent_file")
2100 if err != nil {
2101 t.Fatal("could not create temp symlink, err:", err)
2102 }
2103 tempFiles = append(tempFiles, link)
2104 mockT = new(testing.T)
2105 False(t, NoFileExists(mockT, link))
2106
2107 errs := cleanUpTempFiles(tempFiles)
2108 if len(errs) > 0 {
2109 t.Fatal("could not clean up temporary files")
2110 }
2111}
2112
2113func getTempSymlinkPath(file string) (string, error) {
2114 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…