1 ;;; coding-tests.el --- tests for text encoding and decoding
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
5 ;; Author: Eli Zaretskii <eliz@gnu.org>
7 ;; This file is part of GNU Emacs.
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.
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.
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/>.
26 ;; Directory to hold test data files.
27 (defvar coding-tests-workdir
28 (expand-file-name "coding-tests" temporary-file-directory
))
30 ;; Remove all generated test files.
31 (defun coding-tests-remove-files ()
32 (delete-directory coding-tests-workdir t
))
34 (ert-deftest ert-test-coding-bogus-coding-systems
()
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
))
43 (let ((coding-system-for-read 'bogus
))
44 (insert-file-contents test-file
)))
46 (setq test-file
(expand-file-name "writing" coding-tests-workdir
))
48 (let ((coding-system-for-write (intern "\"us-ascii\"")))
49 (write-region "some text" nil test-file
))))
50 (coding-tests-remove-files)))