(t *testing.T)
| 2206 | } |
| 2207 | |
| 2208 | func 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 | |
| 2242 | func getTempSymlinkPath(file string) (string, error) { |
| 2243 | link := file + "_symlink" |
nothing calls this directly
no test coverage detected