Skip to content

Commit 3eada3b

Browse files
Wilfredgvol
authored andcommitted
Add a unit test for deadgrep-visit-file
1 parent b27ba94 commit 3eada3b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/deadgrep-unit-test.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ some results."
121121
(eq (get-text-property (point) 'face)
122122
'deadgrep-match-face))))
123123

124+
(ert-deftest deadgrep-visit-result ()
125+
"`deadgrep-visit-result' should open the file at point."
126+
(with-temp-deadgrep-buf
127+
(deadgrep-forward-match)
128+
(deadgrep-visit-result)
129+
(let ((buf-name (buffer-file-name)))
130+
(should (s-ends-with-p "deadgrep.el" buf-name)))))
131+
124132
(ert-deftest deadgrep--split-line ()
125133
(-let* ((raw-line
126134
"deadgrep.el:123: (when (buffer-live-p buffer)")
@@ -466,11 +474,11 @@ edit mode."
466474
(let ((deadgrep--file-type 'tests))
467475
(should
468476
(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" "."))))
477+
'("--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--case-sensitive" "--type=TEST" "--before-context=1" "--after-context=0" "--" "foo" "."))))
470478
(let ((deadgrep--file-type 'no-tests))
471479
(should
472480
(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" ".")))))
481+
'("--color=ansi" "--line-number" "--no-heading" "--no-column" "--with-filename" "--fixed-strings" "--case-sensitive" "--type-not=TEST" "--before-context=1" "--after-context=0" "--" "foo" ".")))))
474482
)
475483

476484
(ert-deftest deadgrep--arguments-error-cases ()

0 commit comments

Comments
 (0)