From 1d3f2d1e4c59867024470d3444e12698b7ebb22e Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 14:08:36 +0200 Subject: 0.0.4: max-size, exclude forms, --min-age --- internal/config/settings_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'internal/config/settings_test.go') diff --git a/internal/config/settings_test.go b/internal/config/settings_test.go index e46c880..341c0f3 100644 --- a/internal/config/settings_test.go +++ b/internal/config/settings_test.go @@ -4,6 +4,7 @@ package config import ( "reflect" + "strings" "testing" "time" @@ -27,12 +28,12 @@ func parseSettings(t *testing.T, src string) (Settings, []*Diag) { func TestSettingsResolve(t *testing.T) { s, errs := parseSettings(t, `(case strict) (fold no) (recursive yes) (max-depth 3) - (min-age 5m) (max-read 1G) (busy ".tmp") (on-conflict skip)`) + (min-age 5m) (max-read 1G) (max-size 2G) (busy ".tmp") (on-conflict skip)`) if len(errs) > 0 { t.Fatal(errs) } want := Resolved{Case: CaseStrict, Fold: false, Recursive: true, MaxDepth: 3, - MinAge: 5 * time.Minute, MaxRead: 1 << 30, Busy: []string{".tmp"}, OnConflict: ConflictSkip} + MinAge: 5 * time.Minute, MaxRead: 1 << 30, MaxSize: 2 << 30, Busy: []string{".tmp"}, OnConflict: ConflictSkip} if got := s.Over(Builtin()); !reflect.DeepEqual(got, want) { t.Fatalf("got %+v\nwant %+v", got, want) } @@ -83,3 +84,14 @@ func TestSettingErrors(t *testing.T) { } } } + +// TestMaxSizeErrors: max-size takes a size like max-read does, and is not a +// rule-level setting. +func TestMaxSizeErrors(t *testing.T) { + if _, errs := parseSettings(t, "(max-size big)"); len(errs) != 1 || !strings.Contains(errs[0].Msg, "max-size") { + t.Errorf("(max-size big): errs %v, want one max-size error", errs) + } + if _, errs := parseSettings(t, "(max-size 10M)"); len(errs) != 0 { + t.Errorf("(max-size 10M): errs %v, want none", errs) + } +} -- cgit v1.3