Skip to content

Commit fe0401e

Browse files
committed
Add tests for deadgrep-file-type-alist
1 parent f8900fe commit fe0401e

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
@@ -452,6 +452,19 @@ edit mode."
452452
(equal (deadgrep--arguments "foo" 'words 'ignore '(3 . 2))
453453
'("--color=ansi" "--line-number" "--no-heading" "--with-filename" "--fixed-strings" "--word-regexp" "--ignore-case" "--type-add=custom:*.el" "--type=custom" "--before-context=3" "--after-context=2" "--" "foo" ".")))))
454454

455+
(ert-deftest deadgrep--arguments-custom-file-types ()
456+
(let ((deadgrep-file-type-alist '((tests . "--type=TEST")
457+
(no-tests . "--type-not=TEST"))))
458+
(let ((deadgrep--file-type 'tests))
459+
(should
460+
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
461+
'("--color=ansi" "--line-number" "--no-heading" "--with-filename" "--fixed-strings" "--case-sensitive" "--type=TEST" "--before-context=1" "--after-context=0" "--" "foo" "."))))
462+
(let ((deadgrep--file-type 'no-tests))
463+
(should
464+
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
465+
'("--color=ansi" "--line-number" "--no-heading" "--with-filename" "--fixed-strings" "--case-sensitive" "--type-not=TEST" "--before-context=1" "--after-context=0" "--" "foo" ".")))))
466+
)
467+
455468
(ert-deftest deadgrep--arguments-error-cases ()
456469
(should-error
457470
(deadgrep--arguments "foo" 'foo 'smart nil))

0 commit comments

Comments
 (0)