aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAugusto Stoffel2022-12-07 18:44:07 +0100
committerJuri Linkov2023-02-27 21:14:47 +0200
commit93f557af0ef85ce301bb0780e26351eb8809e91c (patch)
treeebf239aecd0e86cc4384ca40acc8c5bea2e910c7 /test
parentb699c380286151c97ffae65010d733a092d2db14 (diff)
downloademacs-93f557af0ef85ce301bb0780e26351eb8809e91c.tar.gz
emacs-93f557af0ef85ce301bb0780e26351eb8809e91c.zip
New user option 'grep-use-headings'
* lisp/progmodes/grep.el (grep-heading-regexp): New user option. (grep-heading): New face (bug#59888). (grep--heading-format, grep--heading-state, grep--heading-filter): Filter function for grep processes and supporting variables. (grep-use-headings): New user option. (grep-mode): Use the above, if applicable.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/progmodes/grep-tests.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/lisp/progmodes/grep-tests.el b/test/lisp/progmodes/grep-tests.el
index 39307999d6d..9b7f83086bf 100644
--- a/test/lisp/progmodes/grep-tests.el
+++ b/test/lisp/progmodes/grep-tests.el
@@ -66,4 +66,18 @@
66 (cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore)) 66 (cl-letf (((symbol-function 'w32-shell-dos-semantics) #'ignore))
67 (grep-tests--check-rgrep-abbreviation)))) 67 (grep-tests--check-rgrep-abbreviation))))
68 68
69(ert-deftest grep-tests--grep-heading-regexp-without-null ()
70 (dolist (sep '(?: ?- ?=))
71 (let ((string (format "filename%c123%ctext" sep sep)))
72 (should (string-match grep-heading-regexp string))
73 (should (equal (match-string 1 string) "filename"))
74 (should (equal (match-string 2 string) (format "filename%c" sep))))))
75
76(ert-deftest grep-tests--grep-heading-regexp-with-null ()
77 (dolist (sep '(?: ?- ?=))
78 (let ((string (format "funny:0:filename%c123%ctext" 0 sep)))
79 (should (string-match grep-heading-regexp string))
80 (should (equal (match-string 1 string) "funny:0:filename"))
81 (should (equal (match-string 2 string) "funny:0:filename\0")))))
82
69;;; grep-tests.el ends here 83;;; grep-tests.el ends here