(t *testing.T)
| 64 | } |
| 65 | |
| 66 | func TestExists(t *testing.T) { |
| 67 | t.Parallel() |
| 68 | dir := t.TempDir() |
| 69 | if pathutil.Exists("") { |
| 70 | t.Fatal("Exists(\"\") should be false") |
| 71 | } |
| 72 | if pathutil.Exists(filepath.Join(dir, "missing")) { |
| 73 | t.Fatal("Exists on missing path should be false") |
| 74 | } |
| 75 | |
| 76 | file := filepath.Join(dir, "file") |
| 77 | if err := os.WriteFile(file, []byte("hi"), 0o600); err != nil { |
| 78 | t.Fatal(err) |
| 79 | } |
| 80 | if !pathutil.Exists(file) { |
| 81 | t.Fatal("Exists on real file should be true") |
| 82 | } |
| 83 | } |