emacs/test/src/character-tests.el
Sean Whitton fdab8a9185 ; Revert Eric's commits from February.
These will be resubmitted as patches for review.

Revert "Repair another test bollixed by aggressive optimization."
This reverts commit 47735e0243.

Revert "Repair ab ecal test by making a variable kexical,"
This reverts commit ca42055b0c.

Revert "Complete the test set for floatfns,c."
This reverts commit 1b0c8d6b95.

Revert "Tesrts for the portable primitives in fileio.c."
This reverts commit a339c6827c.

Revert "Tests for primitives in coding.c and charset.c."
This reverts commit 5749b2e4f4.

Revert "Tests for primitives from the character.c module."
This reverts commit b09f8df206.

Revert "Tests for the lreaf.c amd print.c primitives."
This reverts commit d7a3d442b4.

Revert "Tests for remaining functions iun eval.c."
This reverts commit cd038e5617.

Revert "Completing test coverage for dataa.c orimitives."
This reverts commit a6e19d6179.

Revert "More correctness tesrs for orinitives from fns.c."
This reverts commit 40ff4512ad.

Revert "More tests for edit functions, buffers, and markers."
This reverts commit 67e8f87562.

Revert "Added more buffer/marker/editing test coverage."
This reverts commit 3dda4b85e8.

Revert "Category/charset/coding + char-table tests."
This reverts commit 7a93a7b334.

Revert "More test coverage improvements."
This reverts commit fc7339c46d.

Revert "More test coverage improvements."
This reverts commit 95329bf445.

Revert "More test coverage improvements for ERT."
This reverts commit e42c579a54.

Revert "Crrections to tedt coverrage extensuion after bootstrap build."
This reverts commit 90af3295c7.

Revert "Improve test coverage of builtin predicates."
This reverts commit 6eb170b007.

Revert "Tests for 2 marker primitives previously not covered."
This reverts commit 6d7f0acf9c.

Revert "Tests for 7 editor primitives previously not covered."
This reverts commit bb403e70ae.
2026-05-07 15:29:53 +01:00

47 lines
1.9 KiB
EmacsLisp

;;; character-tests.el --- tests for character.c -*- lexical-binding:t -*-
;; Copyright (C) 2021-2026 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Code:
(require 'ert)
(ert-deftest character-test-string-width ()
"Test `string-width' with and without compositions."
(should (= (string-width "1234") 4))
(should (= (string-width "12\t34") (+ 4 tab-width)))
(should (= (string-width "áëòç") 4))
(should (= (string-width "áëòç") 4))
(should (= (string-width "הַרְבֵּה אַהֲבָה") 9))
(should (= (string-width "1234" 1 3) 2))
(should (= (string-width "1234" nil -1) 3))
(should (= (string-width "1234" 2) 2))
(should-error (string-width "1234" nil 5))
(should-error (string-width "1234" -5))
(should (= (string-width "12\t34") (+ 4 tab-width)))
(should (= (string-width "1234\t56") (+ 6 tab-width)))
(should (= (string-width "áëòç") 4))
(should (= (string-width "áëòç" nil 3) 3))
(should (= (string-width "áëòç" 1 3) 2))
(should (= (string-width "áëòç" nil 2) 1))
(should (= (string-width "áëòç" nil 3) 2))
(should (= (string-width "áëòç" nil 4) 2))
(should (= (string-width "הַרְבֵּה אַהֲבָה") 9))
(should (= (string-width "הַרְבֵּה אַהֲבָה" nil 8) 4)))
;;; character-tests.el ends here