Skip to content

Commit 7e92277

Browse files
gvolIvan Andrus
authored andcommitted
Add tests for deadgrep-file-type-alist
1 parent ebc910d commit 7e92277

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

479+
(ert-deftest deadgrep--arguments-custom-file-types ()
480+
(let ((deadgrep-file-type-alist '((tests . "--type=TEST")
481+
(no-tests . "--type-not=TEST"))))
482+
(let ((deadgrep--file-type 'tests))
483+
(should
484+
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
485+
'("--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--case-sensitive" "--type=TEST" "--before-context=1" "--after-context=0" "--" "foo" "."))))
486+
(let ((deadgrep--file-type 'no-tests))
487+
(should
488+
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
489+
'("--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--case-sensitive" "--type-not=TEST" "--before-context=1" "--after-context=0" "--" "foo" ".")))))
490+
)
491+
479492
(ert-deftest deadgrep--arguments-error-cases ()
480493
(should-error
481494
(deadgrep--arguments "foo" 'foo 'smart nil))

0 commit comments

Comments
 (0)