Skip to content

Commit e5dd1f7

Browse files
committed
Add tests for deadgrep-file-type-alist
1 parent bbd3be2 commit e5dd1f7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/deadgrep-unit-test.el

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,19 @@ edit mode."
460460
(equal (deadgrep--arguments "foo" 'words 'ignore '(3 . 2))
461461
'("--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--word-regexp" "--ignore-case" "--type-add=custom:*.el" "--type=custom" "--before-context=3" "--after-context=2" "--" "foo" ".")))))
462462

463+
(ert-deftest deadgrep--arguments-custom-file-types ()
464+
(let ((deadgrep-file-type-alist '((tests . "--type=TEST")
465+
(no-tests . "--type-not=TEST"))))
466+
(let ((deadgrep--file-type 'tests))
467+
(should
468+
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
469+
'("--color=ansi" "--line-number" "--no-heading" "--with-filename" "--fixed-strings" "--case-sensitive" "--type=TEST" "--before-context=1" "--after-context=0" "--" "foo" "."))))
470+
(let ((deadgrep--file-type 'no-tests))
471+
(should
472+
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
473+
'("--color=ansi" "--line-number" "--no-heading" "--with-filename" "--fixed-strings" "--case-sensitive" "--type-not=TEST" "--before-context=1" "--after-context=0" "--" "foo" ".")))))
474+
)
475+
463476
(ert-deftest deadgrep--arguments-error-cases ()
464477
(should-error
465478
(deadgrep--arguments "foo" 'foo 'smart nil))

0 commit comments

Comments
 (0)