Skip to content

Commit

Permalink
Add tests for deadgrep-file-type-alist
Browse files Browse the repository at this point in the history
  • Loading branch information
gvol authored and Ivan Andrus committed Sep 10, 2023
1 parent eebca17 commit 3316de7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/deadgrep-unit-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ edit mode."
(equal (deadgrep--arguments "foo" 'words 'ignore '(3 . 2))
'("--no-config" "--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" ".")))))

(ert-deftest deadgrep--arguments-custom-file-types ()
(let ((deadgrep-file-type-alist '((tests . "--type=TEST")
(no-tests . "--type-not=TEST"))))
(let ((deadgrep--file-type 'tests))
(should
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
'("--no-config" "--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--case-sensitive" "--type=TEST" "--before-context=1" "--after-context=0" "--" "foo" "."))))
(let ((deadgrep--file-type 'no-tests))
(should
(equal (deadgrep--arguments "foo" 'string 'sensitive '(1 . 0))
'("--no-config" "--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--case-sensitive" "--type-not=TEST" "--before-context=1" "--after-context=0" "--" "foo" ".")))))
)

(ert-deftest deadgrep--arguments-error-cases ()
(should-error
(deadgrep--arguments "foo" 'foo 'smart nil))
Expand Down

0 comments on commit 3316de7

Please sign in to comment.