aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMattias Engdegård2018-12-29 11:09:27 +0100
committerEli Zaretskii2018-12-29 16:53:27 +0200
commitb71d4ce056ca291594682b2a8536a4a768a97330 (patch)
treea3a2094b1611d1039cc3d728816e9652c83f2a22 /test
parentfb10834a602416f8422131d5ce9dabcc28e57be4 (diff)
downloademacs-b71d4ce056ca291594682b2a8536a4a768a97330.tar.gz
emacs-b71d4ce056ca291594682b2a8536a4a768a97330.zip
Handle raw bytes, and LF in ranges, in rx `any' argument strings
* lisp/emacs-lisp/rx.el (rx-check-any-string): Rewrite to handle raw bytes in unibyte strings and accept LF as range endpoints (Bug#33205). * test/lisp/emacs-lisp/rx-tests.el: Add tests for the above.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/rx-tests.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index d15e3d77199..8b3ce6cb01f 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -33,6 +33,28 @@
33 (number-sequence ?< ?\]) 33 (number-sequence ?< ?\])
34 (number-sequence ?- ?:)))))) 34 (number-sequence ?- ?:))))))
35 35
36(ert-deftest rx-char-any-range-nl ()
37 "Test character alternatives with LF as a range endpoint."
38 (should (equal (rx (any "\n-\r"))
39 "[\n-\r]"))
40 (should (equal (rx (any "\a-\n"))
41 "[\a-\n]")))
42
43(ert-deftest rx-char-any-raw-byte ()
44 "Test raw bytes in character alternatives."
45 ;; Separate raw characters.
46 (should (equal (string-match-p (rx (any "\326A\333B"))
47 "X\326\333")
48 1))
49 ;; Range of raw characters, unibyte.
50 (should (equal (string-match-p (rx (any "\200-\377"))
51 "ÿA\310B")
52 2))
53 ;; Range of raw characters, multibyte.
54 (should (equal (string-match-p (rx (any "Å\211\326-\377\177"))
55 "XY\355\177\327")
56 2)))
57
36(ert-deftest rx-pcase () 58(ert-deftest rx-pcase ()
37 (should (equal (pcase "a 1 2 3 1 1 b" 59 (should (equal (pcase "a 1 2 3 1 1 b"
38 ((rx (let u (+ digit)) space 60 ((rx (let u (+ digit)) space