diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-12 12:58:14 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-12 12:58:14 +0200 |
| commit | 24a84671ace373ae331fa83a1ff484990f4dff0e (patch) | |
| tree | a6b6e3949d7dd241f1d13e079dfb982d758c89a2 /internal/plan/index_test.go | |
| parent | 3b36a48b7ce5a53a9366f3b31f94311f178e2553 (diff) | |
| download | krino-24a84671ace373ae331fa83a1ff484990f4dff0e.tar.gz krino-24a84671ace373ae331fa83a1ff484990f4dff0e.zip | |
krino: planning — chains, placeholders, conflicts, JSON
Diffstat (limited to 'internal/plan/index_test.go')
| -rw-r--r-- | internal/plan/index_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/plan/index_test.go b/internal/plan/index_test.go new file mode 100644 index 0000000..b157f56 --- /dev/null +++ b/internal/plan/index_test.go @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package plan + +import ( + "strings" + "testing" +) + +func TestMaxIndex(t *testing.T) { + for in, want := range map[string]int{ + "Work/Acme": 0, + "{name}": 0, + "{1}": 1, + "Work/{2}/{1}": 2, + "{stem}-{9}{ext}": 9, + "{{1}}": 0, + "{mtime:%Y}/{3}-{1}": 3, + } { + got, err := MaxIndex(in) + if err != nil || got != want { + t.Errorf("MaxIndex(%q) = %d, %v; want %d", in, got, err, want) + } + } + if _, err := MaxIndex("{name"); err == nil || !strings.Contains(err.Error(), "unclosed placeholder") { + t.Errorf("unclosed: %v", err) + } +} |
