diff options
| author | Mattias EngdegÄrd | 2019-10-27 09:54:54 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2019-10-27 09:54:54 +0100 |
| commit | cbd439e785cd1e72c3eae39ed987fda357014bf8 (patch) | |
| tree | 4a10729f3ce701b2d4827259d2bedcb1bcb21cd8 /test | |
| parent | 6e66d9a95c49f867da26ca897635f5e57561d0c7 (diff) | |
| download | emacs-cbd439e785cd1e72c3eae39ed987fda357014bf8.tar.gz emacs-cbd439e785cd1e72c3eae39ed987fda357014bf8.zip | |
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 @@ | |||
| 268 | (should (equal (rx (not (syntax punctuation)) (not (syntax escape))) | 268 | (should (equal (rx (not (syntax punctuation)) (not (syntax escape))) |
| 269 | "\\S.\\S\\")) | 269 | "\\S.\\S\\")) |
| 270 | (should (equal (rx (not (category tone-mark)) (not (category lao))) | 270 | (should (equal (rx (not (category tone-mark)) (not (category lao))) |
| 271 | "\\C4\\Co"))) | 271 | "\\C4\\Co")) |
| 272 | (should (equal (rx (not (not ascii)) (not (not (not (any "a-z"))))) | ||
| 273 | "[[:ascii:]][^a-z]"))) | ||
| 272 | 274 | ||
| 273 | (ert-deftest rx-group () | 275 | (ert-deftest rx-group () |
| 274 | (should (equal (rx (group nonl) (submatch "x") | 276 | (should (equal (rx (group nonl) (submatch "x") |
| @@ -404,6 +406,19 @@ | |||
| 404 | (should-error (rx-let-eval '((not-char () "x")) nil)) | 406 | (should-error (rx-let-eval '((not-char () "x")) nil)) |
| 405 | (should-error (rx-let-eval '((not-char "x")) nil))) | 407 | (should-error (rx-let-eval '((not-char "x")) nil))) |
| 406 | 408 | ||
| 409 | (ert-deftest rx-def-in-not () | ||
| 410 | "Test definition expansion inside (not ...)." | ||
| 411 | (rx-let ((a alpha) | ||
| 412 | (b (not hex)) | ||
| 413 | (c (not (category base))) | ||
| 414 | (d (x) (any ?a x ?z)) | ||
| 415 | (e (x) (syntax x)) | ||
| 416 | (f (not b))) | ||
| 417 | (should (equal (rx (not a) (not b) (not c) (not f)) | ||
| 418 | "[^[:alpha:]][[:xdigit:]]\\c.[^[:xdigit:]]")) | ||
| 419 | (should (equal (rx (not (d ?m)) (not (e symbol))) | ||
| 420 | "[^amz]\\S_")))) | ||
| 421 | |||
| 407 | (ert-deftest rx-constituents () | 422 | (ert-deftest rx-constituents () |
| 408 | (let ((rx-constituents | 423 | (let ((rx-constituents |
| 409 | (append '((beta . gamma) | 424 | (append '((beta . gamma) |