summaryrefslogtreecommitdiff
path: root/test/lisp/international
diff options
context:
space:
mode:
authorMattias Engdegård <mattiase@acm.org>2020-04-06 20:28:05 +0200
committerMattias Engdegård <mattiase@acm.org>2020-04-06 23:51:40 +0200
commit8d95e75eb68745322a23424f1af5ab86f0cb0c3b (patch)
treec873663b904f728161a42f1901d0c44e70c48de4 /test/lisp/international
parent8b04047653865c8d09cea8c852f7b29f33adb907 (diff)
downloademacs-8d95e75eb68745322a23424f1af5ab86f0cb0c3b.tar.gz
emacs-8d95e75eb68745322a23424f1af5ab86f0cb0c3b.tar.bz2
emacs-8d95e75eb68745322a23424f1af5ab86f0cb0c3b.zip
utf-7 and utf-7-imap are not ASCII-compatible (bug#40407)
* lisp/international/mule-conf.el (utf-7, utf-7-imap): Add expedient to disable the :ascii-compatible-p property set automatically by define-coding-system. * test/lisp/international/mule-tests.el (mule-utf-7): New test.
Diffstat (limited to 'test/lisp/international')
-rw-r--r--test/lisp/international/mule-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/lisp/international/mule-tests.el b/test/lisp/international/mule-tests.el
index 91e3c2279f0..bb96943888f 100644
--- a/test/lisp/international/mule-tests.el
+++ b/test/lisp/international/mule-tests.el
@@ -48,6 +48,24 @@
(append (kbd "C-x RET c u t f - 8 RET C-u C-u c a b RET") nil)))
(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) "あ")))
+
+
;; Stop "Local Variables" above causing confusion when visiting this file.