From a1250c11b04b8ad0a713d801942aa3208b6a43de Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 5 Jul 2026 00:12:12 +0300 Subject: add aliases --- internal/resource/file/file_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'internal/resource/file/file_test.go') 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") -- cgit v1.2.3