summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/rx-tests.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2020-03-04 13:57:58 -0800
committerGlenn Morris <rgm@gnu.org>2020-03-04 13:57:58 -0800
commit6a0e1c41040059d1a463fbf69be52e898b30691a (patch)
treea230d2d3d62c8b9124da17e9f55d21d6fcc1ccbb /test/lisp/emacs-lisp/rx-tests.el
parentb6c39214065272e33a544d09b9a341bbe17ed47b (diff)
parenta4e4510ccd92da8ca17743c7dab9b32fc9d850e7 (diff)
downloademacs-6a0e1c41040059d1a463fbf69be52e898b30691a.tar.gz
Merge from origin/emacs-27
a4e4510ccd Fix handling MS-Windows keyboard input above the BMP a38bebb0c1 * etc/NEWS: More complete description of rx 'not' changes. d373647e8f ; * doc/emacs/mini.texi (Yes or No Prompts): Fix last change. 1ca6d15656 * doc/emacs/mini.texi (Yes or No Prompts): 'y-or-n-p' now ... fe1a447d52 Don't attempt to cache glyph metrics for FONT_INVALID_CODE b42b894d1d Fix fit-frame-to-buffer for multi-monitor setup 366fd4fd07 (emacs-27) ; * etc/NEWS: Fix typo. 49d3cd90bd rx: Improve 'or' compositionality (bug#37659) 6b48aedb6b * lisp/tab-line.el: Fix auto-hscrolling (bug#39649) c5f255d681 (tag: emacs-27.0.90) ; Update lisp/ldefs-boot.el 60c84ad992 ; * etc/TODO: Fix last change. 5af9e5baad ; Add an entry to TODO d424195905 Fix rx charset generation 9908b5a614 Merge branch 'emacs-27' of git.savannah.gnu.org:/srv/git/e... 6dc2ebe00e Fix overquoting in mule.el 5cca73dd82 * src/timefns.c (time_arith): Omit incorrect comment. d767c357ca Merge branch 'emacs-27' of git.savannah.gnu.org:/srv/git/e... 4dec693f70 * lisp/vc/vc-cvs.el (vc-cvs-ignore): Copy-edit doc string ff729e3f97 ; bug#39779: Fix some typos in documentation. 696ee02c3a checkdoc: Don't mistake "cf." for sentence end # Conflicts: # etc/NEWS
Diffstat (limited to 'test/lisp/emacs-lisp/rx-tests.el')
-rw-r--r--test/lisp/emacs-lisp/rx-tests.el24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index a6c172adfe7..4888e1d9d1e 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -42,13 +42,24 @@
(ert-deftest rx-or ()
(should (equal (rx (or "ab" (| "c" nonl) "de"))
"ab\\|c\\|.\\|de"))
- (should (equal (rx (or "ab" "abc" "a"))
+ (should (equal (rx (or "ab" "abc" ?a))
"\\(?:a\\(?:bc?\\)?\\)"))
+ (should (equal (rx (or "ab" (| (or "abcd" "abcde")) (or "a" "abc")))
+ "\\(?:a\\(?:b\\(?:c\\(?:de?\\)?\\)?\\)?\\)"))
+ (should (equal (rx (or "a" (eval (string ?a ?b))))
+ "\\(?:ab?\\)"))
(should (equal (rx (| nonl "a") (| "b" blank))
"\\(?:.\\|a\\)\\(?:b\\|[[:blank:]]\\)"))
(should (equal (rx (|))
"\\`a\\`")))
+(ert-deftest rx-def-in-or ()
+ (rx-let ((a b)
+ (b (or "abc" c))
+ (c ?a))
+ (should (equal (rx (or a (| "ab" "abcde") "abcd"))
+ "\\(?:a\\(?:b\\(?:c\\(?:de?\\)?\\)?\\)?\\)"))))
+
(ert-deftest rx-char-any ()
"Test character alternatives with `]' and `-' (Bug#25123)."
(should (equal
@@ -130,7 +141,10 @@
(should (equal (rx (any "") (not (any "")))
"\\`a\\`[^z-a]"))
(should (equal (rx (any space ?a digit space))
- "[a[:space:][:digit:]]")))
+ "[a[:space:][:digit:]]"))
+ (should (equal (rx (not "\n") (not ?\n) (not (any "\n")) (not-char ?\n)
+ (| (not (in "a\n")) (not (char ?\n (?b . ?b)))))
+ ".....")))
(ert-deftest rx-pcase ()
(should (equal (pcase "a 1 2 3 1 1 b"
@@ -298,7 +312,11 @@
(not (any "a-k"))))
"[^abh-k]"))
(should (equal (rx (or ?f (any "b-e") "a") (not (or ?x "y" (any "s-w"))))
- "[a-f][^s-y]")))
+ "[a-f][^s-y]"))
+ (should (equal (rx (not (or (in "abc") (char "bcd"))))
+ "[^a-d]"))
+ (should (equal (rx (or (not (in "abc")) (not (char "bcd"))))
+ "[^bc]")))
(ert-deftest rx-def-in-charset-or ()
(rx-let ((a (any "badc"))