diff options
author | Yuuki Harano <masm+github@masm11.me> | 2021-03-08 21:20:54 +0900 |
---|---|---|
committer | Yuuki Harano <masm+github@masm11.me> | 2021-03-08 21:20:54 +0900 |
commit | 4dda6db3abf4a67455a007d28e14d62a9909f665 (patch) | |
tree | 88d4e316e81f5bdd8b6801ff89ea68cd164e4055 /test/lisp/emacs-lisp/rx-tests.el | |
parent | 565995d408ca65ec9f981f175cca29d2164a5fd0 (diff) | |
parent | 432c1aaa80ce109250a93f50858a03ce3d01ca34 (diff) | |
download | emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.tar.gz emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.tar.bz2 emacs-4dda6db3abf4a67455a007d28e14d62a9909f665.zip |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'test/lisp/emacs-lisp/rx-tests.el')
-rw-r--r-- | test/lisp/emacs-lisp/rx-tests.el | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 12bf4f7978e..2dd1bca22d1 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -156,6 +156,8 @@ "....."))) (ert-deftest rx-pcase () + (should (equal (pcase "i18n" ((rx (let x (+ digit))) (list 'ok x))) + '(ok "18"))) (should (equal (pcase "a 1 2 3 1 1 b" ((rx (let u (+ digit)) space (let v (+ digit)) space @@ -171,7 +173,23 @@ (should (equal (pcase "abc" ((rx (? (let x alpha)) (?? (let y alnum)) ?c) (list x y))) - '("a" "b")))) + '("a" "b"))) + (should (equal (pcase 'not-a-string + ((rx nonl) 'wrong) + (_ 'correct)) + 'correct)) + (should (equal (pcase "PQR" + ((and (rx (let a nonl)) (rx ?z)) + (list 'one a)) + ((rx (let b ?Q)) + (list 'two b))) + '(two "Q"))) + (should (equal (pcase-let (((rx ?B (let z nonl)) "ABC")) + (list 'ok z)) + '(ok "C"))) + (should (equal (pcase-let* (((rx ?E (let z nonl)) "DEF")) + (list 'ok z)) + '(ok "F")))) (ert-deftest rx-kleene () "Test greedy and non-greedy repetition operators." |