Skip to content

Commit

Permalink
Merge a5033fa into 51596cb
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarrientos authored Oct 24, 2022
2 parents 51596cb + a5033fa commit 1329353
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rg-result.el
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ previous file with grouped matches."
(while (setq nextfile (rg-navigate-file-message nextfile nil 1))
(save-excursion
(goto-char nextfile)
(skip-chars-forward "File: ")
(and (looking-at-p "^File: ") (forward-char 6))
(setq filepath (buffer-substring-no-properties (point) (line-end-position))))
(push (cons filepath nextfile) elements))
(nreverse elements))))))
Expand Down
1 change: 1 addition & 0 deletions test/data/limenu.el
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imenu
20 changes: 20 additions & 0 deletions test/rg.el-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,26 @@ method. "
(rg-project-root "/tmp/foo.el"))
"/tmp/")))

(ert-deftest rg-integration-test/imenu-populated ()
"Test that the imenu entries are correct."
:tags '(need-rg)
(rg-run "imenu" "elisp" (concat default-directory "test/data"))
(with-current-buffer (rg-buffer-name)
(rg-wait-for-search-result)
(let ((ientries (funcall imenu-create-index-function)))
(should (equal (length ientries) 1))
(should (equal
'("limenu.el")
(seq-sort #'string-lessp (mapcar #'car ientries))))))
(rg-run "hello" "*.baz" (concat default-directory "test/data"))
(with-current-buffer (rg-buffer-name)
(rg-wait-for-search-result)
(let ((ientries (funcall imenu-create-index-function)))
(should (equal (length ientries) 2))
(should (equal
'("bar.baz" "foo.baz")
(seq-sort #'string-lessp (mapcar #'car ientries)))))))

(ert-deftest rg-integration/command-hiding-hide ()
"Test command hiding when `rg-hide-command` is non nil."
:tags '(need-rg)
Expand Down

0 comments on commit 1329353

Please sign in to comment.