mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-14 01:50:22 -08:00
* test/lisp/bookmark-tests.el (bookmark-tests-data-dir): * test/lisp/calendar/todo-mode-tests.el (todo-test-data-dir): * test/lisp/net/dbus-tests.el (dbus--tests-dir): * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-sample-code-file): * test/lisp/emacs-lisp/package-tests.el (package-test-fake-contents-file): * test/lisp/emacs-lisp/shadow-tests.el (shadow-tests-data-directory): * test/lisp/emacs-lisp/testcover-tests.el (testcover-tests-file-dir, testcover-tests-test-cases): * test/lisp/mail/uudecode-tests.el (uudecode-tests-data-dir): * test/lisp/net/tramp-archive-tests.el (tramp-archive-test-resource-directory): * test/lisp/pcmpl-linux-tests.el (pcmpl-linux-tests-data-dir): * test/lisp/progmodes/cperl-mode-tests.el (cperl-mode-tests-data-directory): * test/lisp/progmodes/flymake-tests.el (flymake-tests-data-directory): * test/lisp/progmodes/ruby-mode-tests.el (ruby-mode-tests-data-dir): * test/lisp/saveplace-tests.el (saveplace-tests-dir): * test/lisp/textmodes/css-mode-tests.el (css-mode-tests-data-dir): Remove. * test/lisp/bookmark-tests.el (bookmark-tests-bookmark-file) (bookmark-tests-example-file, bookmark-tests-bookmark-file-list): * test/lisp/calendar/todo-mode-tests.el (todo-test-file-1) (todo-test-archive-1, with-todo-test, todo-test--add-file): * test/lisp/custom-tests.el (custom--test-theme-variables): * test/lisp/net/dbus-tests.el (dbus--test-introspect): * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests-setup-code-file): * test/lisp/emacs-lisp/package-tests.el (package-test-data-dir) (package-test-desc-from-buffer, package-test-install-single) (package-test-macro-compilation) (package-test-install-prioritized) (package-test-install-multifile, package-test-update-archives) (package-test-update-archives-async) (package-test-update-archives/ignore-nil-entry) (package-test-signed, package-x-test-upload-buffer) (package-x-test-upload-new-version): * test/lisp/emacs-lisp/shadow-tests.el (shadow-case-insensitive): * test/lisp/emacs-lisp/testcover-tests.el (testcover-tests-build-test-cases): * test/lisp/mail/uudecode-tests.el (uudecode-tests-encoded-str) (uudecode-tests-decoded-str): * test/lisp/net/tramp-archive-tests.el (tramp-archive-test-file-archive) (tramp-archive-test-directory): * test/lisp/pcmpl-linux-tests.el (pcmpl-linux-test-fs-types) (pcmpl-linux-test-mounted-directories): * test/lisp/progmodes/cperl-mode-tests.el (cperl-mode-test-bug-10483) (cperl-mode-test-indent-styles): * test/lisp/progmodes/flymake-tests.el (flymake-tests--call-with-fixture): * test/lisp/progmodes/ruby-mode-tests.el (ruby--indent/converted-from-manual-test): * test/lisp/saveplace-tests.el (saveplace-test-save-place-to-alist/dir) (saveplace-test-load-alist-from-file): * test/lisp/textmodes/css-mode-tests.el (css-mode-test-indent): Adjust to use new resource directory macros.
81 lines
2.9 KiB
EmacsLisp
81 lines
2.9 KiB
EmacsLisp
;;; uudecode-tests.el --- Tests for uudecode.el -*- lexical-binding: t -*-
|
|
|
|
;; Copyright (C) 2019-2020 Free Software Foundation, Inc.
|
|
|
|
;; Author: Stefan Kangas <stefankangas@gmail.com>
|
|
|
|
;; 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 <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(require 'ert)
|
|
(require 'ert-x)
|
|
(require 'uudecode)
|
|
|
|
(defun uudecode-tests-read-file (file)
|
|
"Read contents of FILE and return as string."
|
|
(with-temp-buffer
|
|
(insert-file-contents file)
|
|
(buffer-string)))
|
|
|
|
(defvar uudecode-tests-encoded-str
|
|
(uudecode-tests-read-file (ert-resource-file "uuencoded.txt"))
|
|
"Uuencoded data for bookmark-tests.el
|
|
Same as `uudecode-tests-decoded-str' but uuencoded.")
|
|
(defvar uudecode-tests-decoded-str
|
|
(uudecode-tests-read-file (ert-resource-file "uudecoded.txt"))
|
|
"Plain text data for bookmark-tests.el
|
|
Same as `uudecode-tests-encoded-str' but plain text.")
|
|
|
|
(ert-deftest uudecode-tests-decode-region-internal ()
|
|
;; Write to buffer
|
|
(with-temp-buffer
|
|
(insert uudecode-tests-encoded-str)
|
|
(uudecode-decode-region-internal (point-min) (point-max))
|
|
(should (equal (buffer-string) uudecode-tests-decoded-str)))
|
|
;; Write to file
|
|
(with-temp-buffer
|
|
(let ((tmpfile (make-temp-file "uudecode-tests-")))
|
|
(unwind-protect
|
|
(progn
|
|
(insert uudecode-tests-encoded-str)
|
|
(uudecode-decode-region-internal (point-min) (point-max) tmpfile)
|
|
(should (equal (uudecode-tests-read-file tmpfile)
|
|
uudecode-tests-decoded-str)))
|
|
(delete-file tmpfile)))))
|
|
|
|
(ert-deftest uudecode-tests-decode-region-external ()
|
|
;; Write to buffer
|
|
(when uudecode-use-external
|
|
(with-temp-buffer
|
|
(insert uudecode-tests-encoded-str)
|
|
(uudecode-decode-region-external (point-min) (point-max))
|
|
(should (equal (buffer-string) uudecode-tests-decoded-str)))
|
|
;; Write to file
|
|
(with-temp-buffer
|
|
(let ((tmpfile (make-temp-file "uudecode-tests-")))
|
|
(unwind-protect
|
|
(progn
|
|
(insert uudecode-tests-encoded-str)
|
|
(uudecode-decode-region-external (point-min) (point-max) tmpfile)
|
|
(should (equal (uudecode-tests-read-file tmpfile)
|
|
uudecode-tests-decoded-str)))
|
|
(delete-file tmpfile))))))
|
|
|
|
(provide 'uudecode-tests)
|
|
;;; uudecode-tests.el ends here
|