summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/rx-tests.el44
1 files changed, 25 insertions, 19 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index 0cd2c9590b7..344f46764c8 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -274,33 +274,36 @@
(should (equal (rx (not (not ascii)) (not (not (not (any "a-z")))))
"[[:ascii:]][^a-z]")))
-(ert-deftest rx-union ()
- (should (equal (rx (union))
+(ert-deftest rx-charset-or ()
+ (should (equal (rx (or))
"\\`a\\`"))
- (should (equal (rx (union (any "ba")))
+ (should (equal (rx (or (any "ba")))
"[ab]"))
- (should (equal (rx (union (any "a-f") (any "c-k" ?y) (any ?r "x-z")))
+ (should (equal (rx (| (any "a-f") (any "c-k" ?y) (any ?r "x-z")))
"[a-krx-z]"))
- (should (equal (rx (union (not (any "a-m")) (not (any "f-p"))))
+ (should (equal (rx (or (not (any "a-m")) (not (any "f-p"))))
"[^f-m]"))
- (should (equal (rx (union (any "e-m") (not (any "a-z"))))
+ (should (equal (rx (| (any "e-m") (not (any "a-z"))))
"[^a-dn-z]"))
- (should (equal (rx (union (not (any "g-r")) (not (any "t"))))
+ (should (equal (rx (or (not (any "g-r")) (not (any "t"))))
"[^z-a]"))
- (should (equal (rx (not (union (not (any "g-r")) (not (any "t")))))
+ (should (equal (rx (not (or (not (any "g-r")) (not (any "t")))))
"\\`a\\`"))
- (should (equal (rx (union (union (any "a-f") (any "u-z"))
- (any "g-r")))
+ (should (equal (rx (or (| (any "a-f") (any "u-z"))
+ (any "g-r")))
"[a-ru-z]"))
- (should (equal (rx (union (intersection (any "c-z") (any "a-g"))
- (not (any "a-k"))))
+ (should (equal (rx (or (intersection (any "c-z") (any "a-g"))
+ (not (any "a-k"))))
"[^abh-k]")))
-(ert-deftest rx-def-in-union ()
+(ert-deftest rx-def-in-charset-or ()
(rx-let ((a (any "badc"))
- (b (union a (any "def"))))
- (should (equal(rx (union b (any "q")))
- "[a-fq]"))))
+ (b (| a (any "def"))))
+ (should (equal (rx (or b (any "q")))
+ "[a-fq]")))
+ (rx-let ((diff-| (a b) (not (or (not a) b))))
+ (should (equal (rx (diff-| (any "a-z") (any "gr")))
+ "[a-fh-qs-z]"))))
(ert-deftest rx-intersection ()
(should (equal (rx (intersection))
@@ -321,15 +324,18 @@
(should (equal (rx (intersection (any "d-u")
(intersection (any "e-z") (any "a-m"))))
"[e-m]"))
- (should (equal (rx (intersection (union (any "a-f") (any "f-t"))
+ (should (equal (rx (intersection (or (any "a-f") (any "f-t"))
(any "e-w")))
"[e-t]")))
(ert-deftest rx-def-in-intersection ()
(rx-let ((a (any "a-g"))
(b (intersection a (any "d-j"))))
- (should (equal(rx (intersection b (any "e-k")))
- "[e-g]"))))
+ (should (equal (rx (intersection b (any "e-k")))
+ "[e-g]")))
+ (rx-let ((diff-& (a b) (intersection a (not b))))
+ (should (equal (rx (diff-& (any "a-z") (any "m-p")))
+ "[a-lq-z]"))))
(ert-deftest rx-group ()
(should (equal (rx (group nonl) (submatch "x")