diff options
| author | Mattias Engdegård | 2020-05-22 12:21:28 +0200 |
|---|---|---|
| committer | Mattias Engdegård | 2020-05-27 16:29:43 +0200 |
| commit | c5cf630ecd467fdcac13928f7e240cfc98cedc7a (patch) | |
| tree | 874eb44ee930b78552765a2fb56d8ee4d1eea1c5 /test | |
| parent | 0fc4989f34bdaf1bc443d05ece886ea91e7bc9cc (diff) | |
| download | emacs-c5cf630ecd467fdcac13928f7e240cfc98cedc7a.tar.gz emacs-c5cf630ecd467fdcac13928f7e240cfc98cedc7a.zip | |
Don't clobber match data in utf-8-hfs conversion (bug#41445)
Reported by Ture Pålsson.
* lisp/international/ucs-normalize.el
(ucs-normalize-hfs-nfd-post-read-conversion)
(ucs-normalize-hfs-nfd-pre-write-conversion):
Use save-match-data to avoid match data clobber in normalisation.
* test/lisp/international/ucs-normalize-tests.el
(ucs-normalize-save-match-data): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/international/ucs-normalize-tests.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lisp/international/ucs-normalize-tests.el b/test/lisp/international/ucs-normalize-tests.el index c36808ad72f..2c60bd318a2 100644 --- a/test/lisp/international/ucs-normalize-tests.el +++ b/test/lisp/international/ucs-normalize-tests.el | |||
| @@ -341,4 +341,15 @@ implementations: | |||
| 341 | (display-buffer (current-buffer))) | 341 | (display-buffer (current-buffer))) |
| 342 | (message "No changes to failing lines needed")))) | 342 | (message "No changes to failing lines needed")))) |
| 343 | 343 | ||
| 344 | (ert-deftest ucs-normalize-save-match-data () | ||
| 345 | "Verify that match data isn't clobbered (bug#41445)" | ||
| 346 | (string-match (rx (+ digit)) "a47b") | ||
| 347 | (should (equal (match-data t) '(1 3))) | ||
| 348 | (should (equal | ||
| 349 | (decode-coding-string | ||
| 350 | (encode-coding-string "Käsesoßenrührlöffel" 'utf-8-hfs) | ||
| 351 | 'utf-8-hfs) | ||
| 352 | "Käsesoßenrührlöffel")) | ||
| 353 | (should (equal (match-data t) '(1 3)))) | ||
| 354 | |||
| 344 | ;;; ucs-normalize-tests.el ends here | 355 | ;;; ucs-normalize-tests.el ends here |