(t *testing.T)
| 2077 | } |
| 2078 | |
| 2079 | func 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 | |
| 2113 | func getTempSymlinkPath(file string) (string, error) { |
| 2114 | link := file + "_symlink" |
nothing calls this directly
no test coverage detected
searching dependent graphs…