From: Eli Zaretskii Date: Sat, 24 Sep 2016 09:04:55 +0000 (+0300) Subject: ; * test/src/coding-tests.el: Moved from test/lisp/legacy/. X-Git-Tag: emacs-26.0.90~1566 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3facefd162c7fdd20cbac97d2f6d34e74216eb35;p=emacs.git ; * test/src/coding-tests.el: Moved from test/lisp/legacy/. --- diff --git a/test/lisp/legacy/coding-tests.el b/test/lisp/legacy/coding-tests.el deleted file mode 100644 index 772c8735519..00000000000 --- a/test/lisp/legacy/coding-tests.el +++ /dev/null @@ -1,58 +0,0 @@ -;;; coding-tests.el --- tests for text encoding and decoding - -;; Copyright (C) 2015-2016 Free Software Foundation, Inc. - -;; Author: Eli Zaretskii - -;; 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 . - -;;; 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 "nonexistent" 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))) - -;; See issue #5251. -(ert-deftest ert-test-unibyte-buffer-dos-eol-decode () - (with-temp-buffer - (set-buffer-multibyte nil) - (insert (encode-coding-string "あ" 'euc-jp) "\xd" "\n") - (decode-coding-region (point-min) (point-max) 'euc-jp-dos) - (should-not (string-match-p "\^M" (buffer-string))))) diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el new file mode 100644 index 00000000000..772c8735519 --- /dev/null +++ b/test/src/coding-tests.el @@ -0,0 +1,58 @@ +;;; coding-tests.el --- tests for text encoding and decoding + +;; Copyright (C) 2015-2016 Free Software Foundation, Inc. + +;; Author: Eli Zaretskii + +;; 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 . + +;;; 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 "nonexistent" 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))) + +;; See issue #5251. +(ert-deftest ert-test-unibyte-buffer-dos-eol-decode () + (with-temp-buffer + (set-buffer-multibyte nil) + (insert (encode-coding-string "あ" 'euc-jp) "\xd" "\n") + (decode-coding-region (point-min) (point-max) 'euc-jp-dos) + (should-not (string-match-p "\^M" (buffer-string)))))