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.
This commit is contained in:
parent
e9f9827eb0
commit
b552fc05c2
3 changed files with 21 additions and 6 deletions
|
@ -107,7 +107,13 @@
|
|||
"ab"))
|
||||
(should (equal (and (string-match (rx (or "a" "ab" "abc")) s)
|
||||
(match-string 0 s))
|
||||
"a"))))
|
||||
"a")))
|
||||
;; Test zero-argument `or'.
|
||||
(should (equal (rx (or)) regexp-unmatchable)))
|
||||
|
||||
(ert-deftest rx-seq ()
|
||||
;; Test zero-argument `seq'.
|
||||
(should (equal (rx (seq)) "")))
|
||||
|
||||
(provide 'rx-tests)
|
||||
;; rx-tests.el ends here.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue