MCPcopy Index your code
hub / github.com/expr-lang/expr / TestFileExists

Function TestFileExists

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

Source from the content-addressed store, hash-verified

2043}
2044
2045func TestFileExists(t *testing.T) {
2046 mockT := new(testing.T)
2047 True(t, FileExists(mockT, "assertions.go"))
2048
2049 mockT = new(testing.T)
2050 False(t, FileExists(mockT, "random_file"))
2051
2052 mockT = new(testing.T)
2053 False(t, FileExists(mockT, "../_codegen"))
2054
2055 var tempFiles []string
2056
2057 link, err := getTempSymlinkPath("assertions.go")
2058 if err != nil {
2059 t.Fatal("could not create temp symlink, err:", err)
2060 }
2061 tempFiles = append(tempFiles, link)
2062 mockT = new(testing.T)
2063 True(t, FileExists(mockT, link))
2064
2065 link, err = getTempSymlinkPath("non_existent_file")
2066 if err != nil {
2067 t.Fatal("could not create temp symlink, err:", err)
2068 }
2069 tempFiles = append(tempFiles, link)
2070 mockT = new(testing.T)
2071 True(t, FileExists(mockT, link))
2072
2073 errs := cleanUpTempFiles(tempFiles)
2074 if len(errs) > 0 {
2075 t.Fatal("could not clean up temporary files")
2076 }
2077}
2078
2079func TestNoFileExists(t *testing.T) {
2080 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 5

getTempSymlinkPathFunction · 0.85
cleanUpTempFilesFunction · 0.85
TrueFunction · 0.70
FileExistsFunction · 0.70
FalseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…