diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2019-10-27 09:54:54 +0100 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2019-10-27 09:54:54 +0100 |
commit | cbd439e785cd1e72c3eae39ed987fda357014bf8 (patch) | |
tree | 4a10729f3ce701b2d4827259d2bedcb1bcb21cd8 /test | |
parent | 6e66d9a95c49f867da26ca897635f5e57561d0c7 (diff) | |
download | emacs-cbd439e785cd1e72c3eae39ed987fda357014bf8.tar.gz |
Expand rx definitions inside (not ...)
* lisp/emacs-lisp/rx.el (rx--translate-not):
* test/lisp/emacs-lisp/rx-tests.el (rx-not, rx-def-in-not):
* doc/lispref/searching.texi (Rx Constructs, Extending Rx):
Allow user-defined rx constructs to be expanded inside (not ...)
forms, for better composability (bug#37849).
Diffstat (limited to 'test')
-rw-r--r-- | test/lisp/emacs-lisp/rx-tests.el | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index ef2541d83af..4ecc805aead 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -268,7 +268,9 @@ (should (equal (rx (not (syntax punctuation)) (not (syntax escape))) "\\S.\\S\\")) (should (equal (rx (not (category tone-mark)) (not (category lao))) - "\\C4\\Co"))) + "\\C4\\Co")) + (should (equal (rx (not (not ascii)) (not (not (not (any "a-z"))))) + "[[:ascii:]][^a-z]"))) (ert-deftest rx-group () (should (equal (rx (group nonl) (submatch "x") @@ -404,6 +406,19 @@ (should-error (rx-let-eval '((not-char () "x")) nil)) (should-error (rx-let-eval '((not-char "x")) nil))) +(ert-deftest rx-def-in-not () + "Test definition expansion inside (not ...)." + (rx-let ((a alpha) + (b (not hex)) + (c (not (category base))) + (d (x) (any ?a x ?z)) + (e (x) (syntax x)) + (f (not b))) + (should (equal (rx (not a) (not b) (not c) (not f)) + "[^[:alpha:]][[:xdigit:]]\\c.[^[:xdigit:]]")) + (should (equal (rx (not (d ?m)) (not (e symbol))) + "[^amz]\\S_")))) + (ert-deftest rx-constituents () (let ((rx-constituents (append '((beta . gamma) |