diff options
| author | Mattias Engdegård | 2020-12-08 12:47:58 +0100 |
|---|---|---|
| committer | Mattias Engdegård | 2020-12-09 10:35:13 +0100 |
| commit | be4d6b043fa79e2d9a9911ca1c48bdcc84e3bba9 (patch) | |
| tree | c44d668b1703733302d0c8131b4f86c55cf88124 /test/src | |
| parent | 22caab8bacf76ae439f8b647218b37334bfd87bd (diff) | |
| download | emacs-be4d6b043fa79e2d9a9911ca1c48bdcc84e3bba9.tar.gz emacs-be4d6b043fa79e2d9a9911ca1c48bdcc84e3bba9.zip | |
Fix [:upper:] and [:lower:] for Unicode characters (bug#11309)
* src/regex-emacs.c (execute_charset): Add canon_table argument to
allow expression of a correct predicate for [:upper:] and [:lower:].
(mutually_exclusive_p, re_match_2_internal): Pass extra argument.
* test/src/regex-emacs-tests.el (regexp-case-fold, regexp-eszett):
New tests. Parts of regexp-eszett still fail and are commented out.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/regex-emacs-tests.el | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el index f9372e37b11..576630aa5af 100644 --- a/test/src/regex-emacs-tests.el +++ b/test/src/regex-emacs-tests.el | |||
| @@ -803,4 +803,61 @@ This evaluates the TESTS test cases from glibc." | |||
| 803 | (should-not (string-match "å" "\xe5")) | 803 | (should-not (string-match "å" "\xe5")) |
| 804 | (should-not (string-match "[å]" "\xe5"))) | 804 | (should-not (string-match "[å]" "\xe5"))) |
| 805 | 805 | ||
| 806 | (ert-deftest regexp-case-fold () | ||
| 807 | "Test case-sensitive and case-insensitive matching." | ||
| 808 | (let ((case-fold-search nil)) | ||
| 809 | (should (equal (string-match "aB" "ABaB") 2)) | ||
| 810 | (should (equal (string-match "åÄ" "ÅäåäÅÄåÄ") 6)) | ||
| 811 | (should (equal (string-match "λΛ" "lΛλλΛ") 3)) | ||
| 812 | (should (equal (string-match "шШ" "zШшшШ") 3)) | ||
| 813 | (should (equal (string-match "[[:alpha:]]+" ".3aBåÄßλΛшШ中﷽") 2)) | ||
| 814 | (should (equal (match-end 0) 12)) | ||
| 815 | (should (equal (string-match "[[:alnum:]]+" ".3aBåÄßλΛшШ中﷽") 1)) | ||
| 816 | (should (equal (match-end 0) 12)) | ||
| 817 | (should (equal (string-match "[[:upper:]]+" ".3aåλшBÄΛШ中﷽") 6)) | ||
| 818 | (should (equal (match-end 0) 10)) | ||
| 819 | (should (equal (string-match "[[:lower:]]+" ".3BÄΛШaåλш中﷽") 6)) | ||
| 820 | (should (equal (match-end 0) 10))) | ||
| 821 | (let ((case-fold-search t)) | ||
| 822 | (should (equal (string-match "aB" "ABaB") 0)) | ||
| 823 | (should (equal (string-match "åÄ" "ÅäåäÅÄåÄ") 0)) | ||
| 824 | (should (equal (string-match "λΛ" "lΛλλΛ") 1)) | ||
| 825 | (should (equal (string-match "шШ" "zШшшШ") 1)) | ||
| 826 | (should (equal (string-match "[[:alpha:]]+" ".3aBåÄßλΛшШ中﷽") 2)) | ||
| 827 | (should (equal (match-end 0) 12)) | ||
| 828 | (should (equal (string-match "[[:alnum:]]+" ".3aBåÄßλΛшШ中﷽") 1)) | ||
| 829 | (should (equal (match-end 0) 12)) | ||
| 830 | (should (equal (string-match "[[:upper:]]+" ".3aåλшBÄΛШ中﷽") 2)) | ||
| 831 | (should (equal (match-end 0) 10)) | ||
| 832 | (should (equal (string-match "[[:lower:]]+" ".3BÄΛШaåλш中﷽") 2)) | ||
| 833 | (should (equal (match-end 0) 10)))) | ||
| 834 | |||
| 835 | (ert-deftest regexp-eszett () | ||
| 836 | "Test matching of ß and ẞ." | ||
| 837 | ;; ß is a lower-case letter (Ll); ẞ is an upper-case letter (Lu). | ||
| 838 | (let ((case-fold-search nil)) | ||
| 839 | (should (equal (string-match "ß" "ß") 0)) | ||
| 840 | (should (equal (string-match "ß" "ẞ") nil)) | ||
| 841 | (should (equal (string-match "ẞ" "ß") nil)) | ||
| 842 | (should (equal (string-match "ẞ" "ẞ") 0)) | ||
| 843 | (should (equal (string-match "[[:alpha:]]" "ß") 0)) | ||
| 844 | ;; bug#11309 | ||
| 845 | ;;(should (equal (string-match "[[:lower:]]" "ß") 0)) | ||
| 846 | ;;(should (equal (string-match "[[:upper:]]" "ß") nil)) | ||
| 847 | (should (equal (string-match "[[:alpha:]]" "ẞ") 0)) | ||
| 848 | (should (equal (string-match "[[:lower:]]" "ẞ") nil)) | ||
| 849 | (should (equal (string-match "[[:upper:]]" "ẞ") 0))) | ||
| 850 | (let ((case-fold-search t)) | ||
| 851 | (should (equal (string-match "ß" "ß") 0)) | ||
| 852 | (should (equal (string-match "ß" "ẞ") 0)) | ||
| 853 | (should (equal (string-match "ẞ" "ß") 0)) | ||
| 854 | (should (equal (string-match "ẞ" "ẞ") 0)) | ||
| 855 | (should (equal (string-match "[[:alpha:]]" "ß") 0)) | ||
| 856 | ;; bug#11309 | ||
| 857 | ;;(should (equal (string-match "[[:lower:]]" "ß") 0)) | ||
| 858 | ;;(should (equal (string-match "[[:upper:]]" "ß") 0)) | ||
| 859 | (should (equal (string-match "[[:alpha:]]" "ẞ") 0)) | ||
| 860 | (should (equal (string-match "[[:lower:]]" "ẞ") 0)) | ||
| 861 | (should (equal (string-match "[[:upper:]]" "ẞ") 0)))) | ||
| 862 | |||
| 806 | ;;; regex-emacs-tests.el ends here | 863 | ;;; regex-emacs-tests.el ends here |