aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorArtur Malabarba2015-11-28 10:32:46 +0000
committerArtur Malabarba2015-11-28 15:06:37 +0000
commit35c7dc06ed1bd27fc69b2a79e88a8cfb2a6b3dae (patch)
tree8bc77df75389f52131279071d450eac8c8b7721b /test
parentea087151a901da36dd9ddc0843583906afafc7c5 (diff)
downloademacs-35c7dc06ed1bd27fc69b2a79e88a8cfb2a6b3dae.tar.gz
emacs-35c7dc06ed1bd27fc69b2a79e88a8cfb2a6b3dae.zip
* lisp/character-fold.el: Code simplifications
(character-fold-table): Reduce the scope of a variable. (character-fold-to-regexp): Change logic to work directly on the input string. It's a little easier to understand, probably faster, and sets us up for implementing multi-char matches. * test/automated/character-fold-tests.el (character-fold--test-fold-to-regexp): New test.
Diffstat (limited to 'test')
-rw-r--r--test/automated/character-fold-tests.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/automated/character-fold-tests.el b/test/automated/character-fold-tests.el
index 2b1a15c9e76..40f0aecf449 100644
--- a/test/automated/character-fold-tests.el
+++ b/test/automated/character-fold-tests.el
@@ -54,5 +54,15 @@
54 (concat w1 "\s\n\s\t\f\t\n\r\t" w2) 54 (concat w1 "\s\n\s\t\f\t\n\r\t" w2)
55 (concat w1 (make-string 90 ?\s) w2))))) 55 (concat w1 (make-string 90 ?\s) w2)))))
56 56
57(ert-deftest character-fold--test-fold-to-regexp ()
58 (let ((character-fold-table (make-char-table 'character-fold-table)))
59 (aset character-fold-table ?a "abc")
60 (aset character-fold-table ?1 "123")
61 (aset character-fold-table ?\s "-!-")
62 (should (equal (character-fold-to-regexp "a1a1")
63 "abc123abc123"))
64 (should (equal (character-fold-to-regexp "a1 a 1")
65 "abc123\\(?: \\|-!--!-\\)abc\\(?: \\|-!-\\)123"))))
66
57(provide 'character-fold-tests) 67(provide 'character-fold-tests)
58;;; character-fold-tests.el ends here 68;;; character-fold-tests.el ends here