diff options
Diffstat (limited to 'test/lisp/international/mule-tests.el')
-rw-r--r-- | test/lisp/international/mule-tests.el | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/test/lisp/international/mule-tests.el b/test/lisp/international/mule-tests.el index 4265cec14af..94e864817f0 100644 --- a/test/lisp/international/mule-tests.el +++ b/test/lisp/international/mule-tests.el @@ -1,6 +1,6 @@ ;;; mule-tests.el --- unit tests for mule.el -*- lexical-binding: t; -*- -;; Copyright (C) 2017 Free Software Foundation, Inc. +;; Copyright (C) 2017-2022 Free Software Foundation, Inc. ;; This file is part of GNU Emacs. @@ -23,6 +23,8 @@ ;;; Code: +(require 'ert-x) ;For `ert-simulate-keys'. + (ert-deftest find-auto-coding--bug27391 () "Check that Bug#27391 is fixed." (with-temp-buffer @@ -36,4 +38,39 @@ (find-auto-coding "" (buffer-size))) '(utf-8 . :coding))))) +(ert-deftest mule-cmds-tests--encode-ebcdic () + (should (equal (encode-coding-char ?a 'ebcdic-int) "\201")) + (should (not (multibyte-string-p (encode-coding-char ?a 'utf-8))))) + +(ert-deftest mule-cmds--test-universal-coding-system-argument () + (should (equal "ccccccccccccccccab" + (let ((enable-recursive-minibuffers t)) + (ert-simulate-keys + (kbd "C-x RET c u t f - 8 RET C-u C-u c a b RET") + (read-string "prompt:")))))) + +(ert-deftest mule-utf-7 () + ;; utf-7 and utf-7-imap are not ASCII-compatible. + (should-not (coding-system-get 'utf-7 :ascii-compatible-p)) + (should-not (coding-system-get 'utf-7-imap :ascii-compatible-p)) + ;; Invariant ASCII subset. + (let ((s (apply #'string (append (number-sequence #x20 #x25) + (number-sequence #x27 #x7e))))) + (should (equal (encode-coding-string s 'utf-7-imap) s)) + (should (equal (decode-coding-string s 'utf-7-imap) s))) + ;; Escaped ampersand. + (should (equal (encode-coding-string "a&bcd" 'utf-7-imap) "a&-bcd")) + (should (equal (decode-coding-string "a&-bcd" 'utf-7-imap) "a&bcd")) + ;; Ability to encode Unicode. + (should (equal (check-coding-systems-region "あ" nil '(utf-7-imap)) nil)) + (should (equal (encode-coding-string "あ" 'utf-7-imap) "&MEI-")) + (should (equal (decode-coding-string "&MEI-" 'utf-7-imap) "あ"))) + +(ert-deftest mule-hz () + ;; The chinese-hz encoding is not ASCII compatible. + (should-not (coding-system-get 'chinese-hz :ascii-compatible-p))) + +;; Stop "Local Variables" above causing confusion when visiting this file. + + ;;; mule-tests.el ends here |