From 3316de7521c0b5439d0f5b89be9b4310a0344166 Mon Sep 17 00:00:00 2001 From: Ivan Andrus Date: Wed, 13 Jan 2021 21:57:21 -0700 Subject: [PATCH] Add tests for deadgrep-file-type-alist --- test/deadgrep-unit-test.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/deadgrep-unit-test.el b/test/deadgrep-unit-test.el index 4ecb0ce..b02208b 100644 --- a/test/deadgrep-unit-test.el +++ b/test/deadgrep-unit-test.el @@ -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))