diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2022-09-25 16:15:16 -0400 |
commit | 650c20f1ca4e07591a727e1cfcc74b3363d15985 (patch) | |
tree | 85d11f6437cde22f410c25e0e5f71a3131ebd07d /test/src/casefiddle-tests.el | |
parent | 8869332684c2302b5ba1ead4568bbc7ba1c0183e (diff) | |
parent | 4b85ae6a24380fb67a3315eaec9233f17a872473 (diff) | |
download | emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.gz emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.tar.bz2 emacs-650c20f1ca4e07591a727e1cfcc74b3363d15985.zip |
Merge 'master' into noverlay
Diffstat (limited to 'test/src/casefiddle-tests.el')
-rw-r--r-- | test/src/casefiddle-tests.el | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el index 0a9b6c20ec9..652af417293 100644 --- a/test/src/casefiddle-tests.el +++ b/test/src/casefiddle-tests.el @@ -1,6 +1,6 @@ ;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- lexical-binding: t -*- -;; Copyright (C) 2015-2016 Free Software Foundation, Inc. +;; Copyright (C) 2015-2016, 2018-2022 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -57,7 +57,7 @@ errors))) (setq expected (cdr expected))))) (when errors - (ert-fail (mapconcat (lambda (line) line) (nreverse errors) ""))))) + (ert-fail (mapconcat #'identity (nreverse errors)))))) (defconst casefiddle-tests--characters @@ -98,7 +98,7 @@ errors))) (setq props (cdr props) tabs (cdr tabs) expected (cdr expected))))) (when errors - (mapconcat (lambda (line) line) (nreverse errors) ""))))) + (mapconcat #'identity (nreverse errors)))))) (ert-deftest casefiddle-tests-casing-character () @@ -116,7 +116,7 @@ errors))) (setq funcs (cdr funcs) expected (cdr expected))))) (when errors - (mapconcat (lambda (line) line) (nreverse errors) ""))))) + (mapconcat (lambda (line) line) (nreverse errors)))))) (ert-deftest casefiddle-tests-casing-word () @@ -196,7 +196,7 @@ ("fish" "FISH" "fish" "Fish" "Fish") ("Straße" "STRASSE" "straße" "Straße" "Straße") - ;; The word repeated twice to test behaviour at the end of a word + ;; The word repeated twice to test behavior at the end of a word ;; inside of an input string as well as at the end of the string. ("ΌΣΟΣ ΌΣΟΣ" "ΌΣΟΣ ΌΣΟΣ" "όσος όσος" "Όσος Όσος" "ΌΣΟΣ ΌΣΟΣ") ;; What should be done with sole sigma? It is ‘final’ but on the @@ -247,7 +247,8 @@ ;; input upcase downcase [titlecase] (dolist (test '((?a ?A ?a) (?A ?A ?a) (?ł ?Ł ?ł) (?Ł ?Ł ?ł) - (?ß ?ß ?ß) (?ẞ ?ẞ ?ß) + ;; We char-upcase ß to ẞ; see bug #11309. + (?ß ?ẞ ?ß) (?ẞ ?ẞ ?ß) (?ⅷ ?Ⅷ ?ⅷ) (?Ⅷ ?Ⅷ ?ⅷ) (?DŽ ?DŽ ?dž ?Dž) (?Dž ?DŽ ?dž ?Dž) (?dž ?DŽ ?dž ?Dž))) (let ((ch (car test)) @@ -259,5 +260,38 @@ (should (eq tc (capitalize ch))) (should (eq tc (upcase-initials ch)))))) +(defvar casefiddle-oldfunc region-extract-function) + +(defun casefiddle-loopfunc (method) + (if (eq method 'bounds) + (let ((looping (list '(1 . 1)))) + (setcdr looping looping)) + (funcall casefiddle-oldfunc method))) + +(defun casefiddle-badfunc (method) + (if (eq method 'bounds) + '(()) + (funcall casefiddle-oldfunc method))) + +(ert-deftest casefiddle-invalid-region-extract-function () + (dolist (region-extract-function '(casefiddle-badfunc casefiddle-loopfunc)) + (with-temp-buffer + (should-error (upcase-region nil nil t))))) + +(ert-deftest casefiddle-turkish () + (skip-unless (member "tr_TR.utf8" (get-locale-names))) + ;; See bug#50752. The point is that unibyte and multibyte strings + ;; are upcased differently in the "dotless i" case in Turkish, + ;; turning ASCII into non-ASCII, which is very unusual. + (with-locale-environment "tr_TR.utf8" + (should (string-equal (downcase "I ı") "ı ı")) + (should (string-equal (downcase "İ i") "i̇ i")) + (should (string-equal (downcase "I") "i")) + (should (string-equal (capitalize "bIte") "Bite")) + (should (string-equal (capitalize "bIté") "Bıté")) + (should (string-equal (capitalize "indIa") "India")) + ;; This does not work -- it produces "Indıa". + ;;(should (string-equal (capitalize "indIá") "İndıa")) + )) ;;; casefiddle-tests.el ends here |