aboutsummaryrefslogtreecommitdiff
path: root/internal/cond/eval_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/cond/eval_test.go')
-rw-r--r--internal/cond/eval_test.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/cond/eval_test.go b/internal/cond/eval_test.go
index 3607978..8891de7 100644
--- a/internal/cond/eval_test.go
+++ b/internal/cond/eval_test.go
@@ -37,12 +37,18 @@ func (f *fake) Size() int64 { return f.size }
func (f *fake) ModTime() time.Time { return now.Add(-f.age) }
func (f *fake) Now() time.Time { return now }
func (f *fake) Matched() bool { return f.matched }
-func (f *fake) Content(ic, fold bool) (string, error) {
+func (f *fake) ContentContains(opt Options, keywords []string) (int, error) {
f.contentCalls++
if f.rawErr != nil {
- return "", f.rawErr
+ return -1, f.rawErr
}
- return norm.Text(f.raw, ic, fold), nil
+ text := norm.Text(f.raw, opt.IgnoreCase, opt.Fold)
+ for i, kw := range keywords {
+ if strings.Contains(text, kw) {
+ return i, nil
+ }
+ }
+ return -1, nil
}
func (f *fake) Duplicate(dirs []string) (string, bool, error) { return f.dupOrig, f.dupOK, nil }