aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMattias EngdegÄrd2019-05-15 22:44:00 +0200
committerMattias EngdegÄrd2019-05-20 11:39:46 +0200
commitb552fc05c231ca6800330a318d3a74ddd0f5a13c (patch)
tree5e030d1bcd878517891180a58d8ba2cec62c1899 /test
parente9f9827eb01a382bead6c180f6703322167e6f89 (diff)
downloademacs-b552fc05c231ca6800330a318d3a74ddd0f5a13c.tar.gz
emacs-b552fc05c231ca6800330a318d3a74ddd0f5a13c.zip
Allow zero-argument rx `or' and `seq' forms
Make the rx `or' and `seq' forms accept zero arguments to produce a never-matching regexp and an empty string, respectively. * lisp/emacs-lisp/rx.el (rx-constituents, rx-or): Permit zero args. (rx): Amend doc string for `or' and `seq'. * test/lisp/emacs-lisp/rx-tests.el (rx-or, rx-seq): Test the change. * etc/NEWS (Changes in Specialized Modes and Packages): Mention the change.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/emacs-lisp/rx-tests.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index 4a5919edf02..6f392d616d1 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -107,7 +107,13 @@
107 "ab")) 107 "ab"))
108 (should (equal (and (string-match (rx (or "a" "ab" "abc")) s) 108 (should (equal (and (string-match (rx (or "a" "ab" "abc")) s)
109 (match-string 0 s)) 109 (match-string 0 s))
110 "a")))) 110 "a")))
111 ;; Test zero-argument `or'.
112 (should (equal (rx (or)) regexp-unmatchable)))
113
114(ert-deftest rx-seq ()
115 ;; Test zero-argument `seq'.
116 (should (equal (rx (seq)) "")))
111 117
112(provide 'rx-tests) 118(provide 'rx-tests)
113;; rx-tests.el ends here. 119;; rx-tests.el ends here.