summaryrefslogtreecommitdiff
path: root/test/src/coding-tests.el
diff options
context:
space:
mode:
authorMattias Engdegård <mattiase@acm.org>2020-04-08 17:13:39 +0200
committerMattias Engdegård <mattiase@acm.org>2020-04-09 12:06:39 +0200
commit786887cf439450ce7d8d6fbe624e8c434e50d469 (patch)
treee097dce7c9f47bbc69dc0025076623ac4c014f14 /test/src/coding-tests.el
parent402cbc5be26827244075dbe14288e7722290f83a (diff)
downloademacs-786887cf439450ce7d8d6fbe624e8c434e50d469.tar.gz
Don't crash with invalid argument in check-coding-systems-region
* src/coding.c (Fcheck_coding_systems_region): Don't crash if the third arg contains something that isn't a coding system. * test/src/coding-tests.el (coding-check-coding-systems-region): New test.
Diffstat (limited to 'test/src/coding-tests.el')
-rw-r--r--test/src/coding-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el
index 83a06b8179e..8d92bcdcd1a 100644
--- a/test/src/coding-tests.el
+++ b/test/src/coding-tests.el
@@ -411,6 +411,14 @@
(should (eq (decode-coding-string s coding t) s))
(should (eq (encode-coding-string s coding t) s))))))
+(ert-deftest coding-check-coding-systems-region ()
+ (should (equal (check-coding-systems-region "aå" nil '(utf-8))
+ nil))
+ (should (equal (check-coding-systems-region "aåbγc" nil
+ '(utf-8 iso-latin-1 us-ascii))
+ '((iso-latin-1 3) (us-ascii 1 3))))
+ (should-error (check-coding-systems-region "å" nil '(bad-coding-system))))
+
;; Local Variables:
;; byte-compile-warnings: (not obsolete)
;; End: