diff options
| author | Mattias EngdegÄrd | 2019-01-16 14:57:12 +0100 |
|---|---|---|
| committer | Eli Zaretskii | 2019-02-01 11:39:43 +0200 |
| commit | decdff76fb185f87145940cc3b91549f84600a87 (patch) | |
| tree | cc3bc3fd672616f1880472c066bee367450e072d /test | |
| parent | b01a4295c2f9bb58858880e4e28b05cc8396791c (diff) | |
| download | emacs-decdff76fb185f87145940cc3b91549f84600a87.tar.gz emacs-decdff76fb185f87145940cc3b91549f84600a87.zip | |
Make the rx operators \? and \?? behave correctly
* lisp/emacs-lisp/rx.el (rx-kleene):
Treat \? and \?? like ? and ?? (Bug#34100).
* test/lisp/emacs-lisp/rx-tests.el: Add tests for all repetition operators.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/rx-tests.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 392a38ab95b..f15e1016f7c 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el | |||
| @@ -65,5 +65,28 @@ | |||
| 65 | (list u v))) | 65 | (list u v))) |
| 66 | '("1" "3")))) | 66 | '("1" "3")))) |
| 67 | 67 | ||
| 68 | (ert-deftest rx-kleene () | ||
| 69 | "Test greedy and non-greedy repetition operators." | ||
| 70 | (should (equal (rx (* "a") (+ "b") (\? "c") (?\s "d") | ||
| 71 | (*? "e") (+? "f") (\?? "g") (?? "h")) | ||
| 72 | "a*b+c?d?e*?f+?g??h??")) | ||
| 73 | (should (equal (rx (zero-or-more "a") (0+ "b") | ||
| 74 | (one-or-more "c") (1+ "d") | ||
| 75 | (zero-or-one "e") (optional "f") (opt "g")) | ||
| 76 | "a*b*c+d+e?f?g?")) | ||
| 77 | (should (equal (rx (minimal-match | ||
| 78 | (seq (* "a") (+ "b") (\? "c") (?\s "d") | ||
| 79 | (*? "e") (+? "f") (\?? "g") (?? "h")))) | ||
| 80 | "a*b+c?d?e*?f+?g??h??")) | ||
| 81 | (should (equal (rx (minimal-match | ||
| 82 | (seq (zero-or-more "a") (0+ "b") | ||
| 83 | (one-or-more "c") (1+ "d") | ||
| 84 | (zero-or-one "e") (optional "f") (opt "g")))) | ||
| 85 | "a*?b*?c+?d+?e??f??g??")) | ||
| 86 | (should (equal (rx (maximal-match | ||
| 87 | (seq (* "a") (+ "b") (\? "c") (?\s "d") | ||
| 88 | (*? "e") (+? "f") (\?? "g") (?? "h")))) | ||
| 89 | "a*b+c?d?e*?f+?g??h??"))) | ||
| 90 | |||
| 68 | (provide 'rx-tests) | 91 | (provide 'rx-tests) |
| 69 | ;; rx-tests.el ends here. | 92 | ;; rx-tests.el ends here. |