From d4f6927d48043d01929a93da53a64b1e4296f994 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mattias=20Engdeg=C3=A5rd?= Date: Fri, 19 Feb 2021 13:44:25 +0100 Subject: [PATCH] Fix regexp mistakes * lisp/progmodes/cperl-mode.el (cperl--package-regexp): Avoid double repetition; cperl--ws-or-comment-regexp is already repeated with 1+. * test/lisp/textmodes/dns-mode-tests.el (dns-mode-tests-dns-mode-soa-increment-serial): Escape literal '$'. * test/lisp/emacs-lisp/rx-tests.el (rx-regexp): Modify test to not trigger a linting warning while retaining its testing power. --- lisp/progmodes/cperl-mode.el | 2 +- test/lisp/emacs-lisp/rx-tests.el | 4 ++-- test/lisp/textmodes/dns-mode-tests.el | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index d01bd3a48ef..db142c0dc3e 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -1305,7 +1305,7 @@ is a legal variable name).") (group (regexp ,cperl--normal-identifier-regexp)) (opt (sequence - (1+ (regexp ,cperl--ws-or-comment-regexp)) + (regexp ,cperl--ws-or-comment-regexp) (group (regexp ,cperl--version-regexp)))))) "A regular expression for package NAME VERSION in Perl. Contains two groups for the package name and version.") diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 388c5e86b4c..12bf4f7978e 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -388,11 +388,11 @@ (ert-deftest rx-regexp () (should (equal (rx (regexp "abc") (regex "[de]")) "\\(?:abc\\)[de]")) + (should (equal (rx "a" (regexp "$")) + "a\\(?:$\\)")) (let ((x "a*")) (should (equal (rx (regexp x) "b") "\\(?:a*\\)b")) - (should (equal (rx "a" (regexp "*")) - "a\\(?:*\\)")) (should (equal (rx "" (regexp x) (eval "")) "a*")))) diff --git a/test/lisp/textmodes/dns-mode-tests.el b/test/lisp/textmodes/dns-mode-tests.el index 92b6cc9177c..8bc48732c62 100644 --- a/test/lisp/textmodes/dns-mode-tests.el +++ b/test/lisp/textmodes/dns-mode-tests.el @@ -37,7 +37,7 @@ (dns-mode-soa-increment-serial) ;; Number is updated from 2015080302 to the current date ;; (actually, just ensure the year part is later than 2020). - (should (string-match "$TTL 86400 + (should (string-match "\\$TTL 86400 @ IN SOA ns.icann.org. noc.dns.icann.org. ( 20[2-9][0-9]+ ;Serial 7200 ;Refresh -- 2.39.2