diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-05 00:12:12 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-05 00:12:12 +0300 |
| commit | a1250c11b04b8ad0a713d801942aa3208b6a43de (patch) | |
| tree | dcf3ae6d0074052efe21e3461911b768a91e25c8 /internal/resource/file/file_test.go | |
| parent | 8228ba742f6b23a93e6a00006feba29225ea89c7 (diff) | |
add aliases
Diffstat (limited to 'internal/resource/file/file_test.go')
| -rw-r--r-- | internal/resource/file/file_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/resource/file/file_test.go b/internal/resource/file/file_test.go index 662aee7..b3b7711 100644 --- a/internal/resource/file/file_test.go +++ b/internal/resource/file/file_test.go @@ -182,6 +182,25 @@ func TestHaveAbsent(t *testing.T) { } } +func TestAbsent(t *testing.T) { + dir := t.TempDir() + path := filepath.Join(dir, "gone.txt") + if err := os.WriteFile(path, []byte("bye"), 0o644); err != nil { + t.Fatal(err) + } + + Absent(path) + if _, err := os.Stat(path); !os.IsNotExist(err) { + t.Errorf("expected %s to be removed", path) + } + + // Idempotent: removing a missing file is not an error (direct call to + // avoid duplicate registration in the one-per-process registry). + if err := ensureAbsent(path); err != nil { + t.Fatalf("absent on missing file: %v", err) + } +} + func TestResolveStripsTmplSuffixWhenSourceHasTmplSuffix(t *testing.T) { dir := t.TempDir() sourcePath := filepath.Join(dir, "foo.conf.tmpl") |
