diff options
| author | ewy <ewy0@protonmail.com> | 2026-04-22 19:47:29 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-04-22 19:47:29 +0200 |
| commit | c6a362a039b1662dfc0badeb8badc4458e446787 (patch) | |
| tree | 40ed4abc183e65d8341d47454b81036200173406 /search/search_test.go | |
| parent | 37900eae9d3c00a9c93a6ef2816b879f6c6f072b (diff) | |
work out the "default" behaviour a little better
Diffstat (limited to 'search/search_test.go')
| -rw-r--r-- | search/search_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/search/search_test.go b/search/search_test.go index 5eaa1b9..3671f75 100644 --- a/search/search_test.go +++ b/search/search_test.go @@ -133,3 +133,24 @@ func TestSearch_SourceDefault(t *testing.T) { assert.Equal(t, res.Target, src.Targets[0]) assert.False(t, res.NeedsConfirmation) } + +func TestSearch_SourceDefault_Other(t *testing.T) { + src := testx.TSource("src", "src", "other") + st := testx.TState(src) + res := Search(st, "src", "other") + assert.Nil(t, res.Args) + assert.Equal(t, res.Target, src.Targets[1]) + assert.False(t, res.NeedsConfirmation) +} + +func TestSearch_SubdirDefault_Other(t *testing.T) { + tgt := testx.TTarget("subname", "subname") + other := testx.TTarget("othername", "subname") + src := testx.TSource("src") + src.Targets = append(src.Targets, tgt, other) + st := testx.TState(src) + res := Search(st, "subname", "othername") + assert.Nil(t, res.Args) + assert.Equal(t, other, res.Target) + assert.False(t, res.NeedsConfirmation) +} |
