diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-15 22:11:33 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-15 22:11:33 +0200 |
| commit | 77a015b96db8727bb12d0869f180a44d087f6319 (patch) | |
| tree | d6e4e485f4556a676fd92a6792602fec690065be /cmd/krino/exclude_test.go | |
| parent | 6b38d302daa54140e4e26ad903297a1bba0cbd41 (diff) | |
| download | krino-77a015b96db8727bb12d0869f180a44d087f6319.tar.gz krino-77a015b96db8727bb12d0869f180a44d087f6319.zip | |
an undecided (stop) rule ends the search for that file
Diffstat (limited to 'cmd/krino/exclude_test.go')
| -rw-r--r-- | cmd/krino/exclude_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cmd/krino/exclude_test.go b/cmd/krino/exclude_test.go index e9d4433..f76be0c 100644 --- a/cmd/krino/exclude_test.go +++ b/cmd/krino/exclude_test.go @@ -165,3 +165,26 @@ func TestVerboseListsDirectoriesLeftOutOfTheWalk(t *testing.T) { t.Errorf("listed without -v:\n%s", out) } } + +// TestExplainShowsAnUndecidedRule: explain names a rule it could not decide +// "undecided", not "no" (plan 12). +func TestExplainShowsAnUndecidedRule(t *testing.T) { + h := home(t) + dl := filepath.Join(h, "dl") + os.MkdirAll(dl, 0o755) + p := filepath.Join(dl, "big.txt") + os.WriteFile(p, []byte("confidential "+strings.Repeat("x", 2048)), 0o644) + old := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC) + os.Chtimes(p, old, old) + if code, _, errOut := runCLI(t, "init"); code != 0 { + t.Fatal(errOut) + } + if code, _, errOut := runCLI(t, "new", "dl", dl); code != 0 { + t.Fatal(errOut) + } + os.WriteFile(filepath.Join(h, ".config", "krino", "dirs", "dl.conf"), []byte("(path \"~/dl\")\n(max-read 1K)\n(rule \"keep\" (when (content \"confidential\")) (stop))\n(rule \"all\" (move \"Out\"))\n"), 0o644) + _, out, errOut := runCLI(t, "explain", p) + if !strings.Contains(out, "rule keep: undecided") || !strings.Contains(out, "rule all: not evaluated, stopped by rule keep, which could not be decided") { + t.Errorf("explain output:\n%s\n%s", out, errOut) + } +} |
