diff options
author | Philipp Stephani <phst@google.com> | 2017-01-06 15:56:51 +0100 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2017-01-06 20:12:48 +0100 |
commit | 512e9886be693f61f9d1932f19461bf4482fba51 (patch) | |
tree | 84a9576c26b01fc8990e9290a3e52a3cb38c4550 /test/lisp/subr-tests.el | |
parent | 8f0376309ee37e4f1da21d78971c4df2df5fd7b6 (diff) | |
download | emacs-512e9886be693f61f9d1932f19461bf4482fba51.tar.gz emacs-512e9886be693f61f9d1932f19461bf4482fba51.tar.bz2 emacs-512e9886be693f61f9d1932f19461bf4482fba51.zip |
Add support for Unicode whitespace in [:blank:]
See Bug#25366.
* src/character.c (blankp): New function for checking Unicode
horizontal whitespace.
* src/regex.c (ISBLANK): Use 'blankp' for non-ASCII horizontal
whitespace.
(BIT_BLANK): New bit for range table.
(re_wctype_to_bit, execute_charset): Use it.
* test/lisp/subr-tests.el (subr-tests--string-match-p--blank): Add
unit test for [:blank:] character class.
* test/src/regex-tests.el (test): Adapt unit test.
* doc/lispref/searching.texi (Char Classes): Document new Unicode
behavior for [:blank:].
Diffstat (limited to 'test/lisp/subr-tests.el')
-rw-r--r-- | test/lisp/subr-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el index 3c5dbcdbd76..a3b08e96971 100644 --- a/test/lisp/subr-tests.el +++ b/test/lisp/subr-tests.el @@ -271,5 +271,15 @@ indirectly `mapbacktrace'." (let ((frame-lists (subr-test--frames-1 'subr-test--frames-2))) (should (equal (car frame-lists) (cdr frame-lists))))) +(ert-deftest subr-tests--string-match-p--blank () + "Test that [:blank:] matches horizontal whitespace, cf. Bug#25366." + (should (equal (string-match-p "\\`[[:blank:]]\\'" " ") 0)) + (should (equal (string-match-p "\\`[[:blank:]]\\'" "\t") 0)) + (should-not (string-match-p "\\`[[:blank:]]\\'" "\n")) + (should-not (string-match-p "\\`[[:blank:]]\\'" "a")) + (should (equal (string-match-p "\\`[[:blank:]]\\'" "\N{HAIR SPACE}") 0)) + (should (equal (string-match-p "\\`[[:blank:]]\\'" "\u3000") 0)) + (should-not (string-match-p "\\`[[:blank:]]\\'" "\N{LINE SEPARATOR}"))) + (provide 'subr-tests) ;;; subr-tests.el ends here |