diff options
| author | K. Handa <handa@gnu.org> | 2015-10-05 22:56:26 +0900 |
|---|---|---|
| committer | K. Handa <handa@gnu.org> | 2015-10-05 22:56:26 +0900 |
| commit | 47e9556c70a7009d7c750fd7bf10a0e6cf41cdce (patch) | |
| tree | 4e944bd68080adee76291dd7d4f34103e2b55d50 /test/automated/coding-tests.el | |
| parent | 52beda922d2cb523a03661bf74b8678c8b45e440 (diff) | |
| parent | ef171d1d0b42758b5f705847d558436e867372f4 (diff) | |
| download | emacs-47e9556c70a7009d7c750fd7bf10a0e6cf41cdce.tar.gz | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'test/automated/coding-tests.el')
| -rw-r--r-- | test/automated/coding-tests.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/automated/coding-tests.el b/test/automated/coding-tests.el new file mode 100644 index 00000000000..ebbf8968fc7 --- /dev/null +++ b/test/automated/coding-tests.el @@ -0,0 +1,50 @@ +;;; coding-tests.el --- tests for text encoding and decoding + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Eli Zaretskii <eliz@gnu.org> + +;; 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 <http://www.gnu.org/licenses/>. + +;;; Code: + +(require 'ert) + +;; Directory to hold test data files. +(defvar coding-tests-workdir + (expand-file-name "coding-tests" temporary-file-directory)) + +;; Remove all generated test files. +(defun coding-tests-remove-files () + (delete-directory coding-tests-workdir t)) + +(ert-deftest ert-test-coding-bogus-coding-systems () + (unwind-protect + (let (test-file) + (or (file-directory-p coding-tests-workdir) + (mkdir coding-tests-workdir t)) + (setq test-file (expand-file-name "nonexisting" coding-tests-workdir)) + (if (file-exists-p test-file) + (delete-file test-file)) + (should-error + (let ((coding-system-for-read 'bogus)) + (insert-file-contents test-file))) + ;; See bug #21602. + (setq test-file (expand-file-name "writing" coding-tests-workdir)) + (should-error + (let ((coding-system-for-write (intern "\"us-ascii\""))) + (write-region "some text" nil test-file)))) + (coding-tests-remove-files))) |
