diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-08-11 09:16:27 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-08-11 09:17:52 +0200 |
| commit | 75d0b8527f51aae42d23eee4aeb263e19055747e (patch) | |
| tree | 1ac67f9cd9f29063de0fa7b937940dcb6346a43c | |
| parent | 6a60af22da1f1a7b08457a4016b9412a475afe4a (diff) | |
compat-tests: Check that `string-search' preserves the `match-data'
See @phikal's mail on emacs-devel:
https://lists.gnu.org/archive/html/emacs-devel/2023-08/msg00325.html
| -rw-r--r-- | compat-tests.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compat-tests.el b/compat-tests.el index 02fa536..1e902fb 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -2136,7 +2136,12 @@ ;; backport this behaviour. (should-equal 2 (string-search (compat-tests--string-to-multibyte "\377") "ab\377c")) (should-equal 2 (string-search (compat-tests--string-to-multibyte "o\303\270") - "foo\303\270")))) + "foo\303\270"))) + ;; Ensure that `match-data' is preserved by `string-search' + (string-match (rx (* "a") (group (* "b")) (* "a")) "abba") + (should-equal '(0 4 1 3) (match-data)) + (should (string-search "foo" "foobar")) + (should-equal '(0 4 1 3) (match-data))) (ert-deftest compat-string-replace () (should-equal "bba" (string-replace "aa" "bb" "aaa")) |
