diff options
| author | Eli Zaretskii | 2015-10-04 16:07:23 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-10-04 16:07:23 +0300 |
| commit | cacebbdaec5b38f02f5c1c4e9c7766a99835197f (patch) | |
| tree | abea0a906afc5c6f50a39fe8517577319388bd65 | |
| parent | acfb5cd0353406784f085ddb6edfb0d0587048c8 (diff) | |
| download | emacs-cacebbdaec5b38f02f5c1c4e9c7766a99835197f.tar.gz emacs-cacebbdaec5b38f02f5c1c4e9c7766a99835197f.zip | |
* test/automated/coding-tests.el: New file.
| -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 @@ | |||
| 1 | ;;; coding-tests.el --- tests for text encoding and decoding | ||
| 2 | |||
| 3 | ;; Copyright (C) 2015 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Code: | ||
| 23 | |||
| 24 | (require 'ert) | ||
| 25 | |||
| 26 | ;; Directory to hold test data files. | ||
| 27 | (defvar coding-tests-workdir | ||
| 28 | (expand-file-name "coding-tests" temporary-file-directory)) | ||
| 29 | |||
| 30 | ;; Remove all generated test files. | ||
| 31 | (defun coding-tests-remove-files () | ||
| 32 | (delete-directory coding-tests-workdir t)) | ||
| 33 | |||
| 34 | (ert-deftest ert-test-coding-bogus-coding-systems () | ||
| 35 | (unwind-protect | ||
| 36 | (let (test-file) | ||
| 37 | (or (file-directory-p coding-tests-workdir) | ||
| 38 | (mkdir coding-tests-workdir t)) | ||
| 39 | (setq test-file (expand-file-name "nonexisting" coding-tests-workdir)) | ||
| 40 | (if (file-exists-p test-file) | ||
| 41 | (delete-file test-file)) | ||
| 42 | (should-error | ||
| 43 | (let ((coding-system-for-read 'bogus)) | ||
| 44 | (insert-file-contents test-file))) | ||
| 45 | ;; See bug #21602. | ||
| 46 | (setq test-file (expand-file-name "writing" coding-tests-workdir)) | ||
| 47 | (should-error | ||
| 48 | (let ((coding-system-for-write (intern "\"us-ascii\""))) | ||
| 49 | (write-region "some text" nil test-file)))) | ||
| 50 | (coding-tests-remove-files))) | ||