]> git.rkrishnan.org Git - .emacs.d.git/blob - emacs/nxhtml/tests/emacstest-suites.el
5953fac0303789f5f0c116c6440922c476f00bee
[.emacs.d.git] / emacs / nxhtml / tests / emacstest-suites.el
1 ;;; emacstest-suites.el --- Some unit tests for Emacs
2 ;;
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-09-21T22:34:11+0200 Sun
5 ;; Version:
6 ;; Last-Updated: 2008-09-22T00:36:11+0200 Sun
7 ;; URL:
8 ;; Keywords:
9 ;; Compatibility:
10 ;;
11 ;; Features that might be required by this library:
12 ;;
13 ;;   `button', `cl', `debug', `ert', `ert2', `ewoc', `find-func',
14 ;;   `help-fns', `help-mode', `view'.
15 ;;
16 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 ;;
18 ;;; Commentary:
19 ;;
20 ;; Unit tests for some Emacs bug reports.
21 ;;
22 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23 ;;
24 ;;; Change log:
25 ;;
26 ;;
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;
29 ;; This program is free software; you can redistribute it and/or
30 ;; modify it under the terms of the GNU General Public License as
31 ;; published by the Free Software Foundation; either version 2, or
32 ;; (at your option) any later version.
33 ;;
34 ;; This program is distributed in the hope that it will be useful,
35 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
36 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
37 ;; General Public License for more details.
38 ;;
39 ;; You should have received a copy of the GNU General Public License
40 ;; along with this program; see the file COPYING.  If not, write to
41 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
42 ;; Floor, Boston, MA 02110-1301, USA.
43 ;;
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45 ;;
46 ;;; Code:
47
48 (eval-when-compile (require 'cl))
49 (eval-when-compile
50   (let* ((this-file (or load-file-name
51                         (when (boundp 'bytecomp-filename) bytecomp-filename)
52                         buffer-file-name))
53          (this-dir (file-name-directory this-file))
54          (load-path (cons this-dir load-path)))
55     (require 'ert2)))
56
57 (setq debug-on-error t)
58
59 (defvar emacstest-bin
60   (file-name-directory (if load-file-name load-file-name buffer-file-name)))
61
62 (pushnew emacstest-bin load-path)
63
64
65
66 (defvar emacstest-files-root
67   (let* ((this-dir emacstest-bin)
68          (root (expand-file-name "inemacs/" this-dir)))
69     (unless (file-accessible-directory-p root)
70           (error (if (file-exists-p root)
71                      "Can't read files in test directory %s"
72                    "Can't find test directory %s")
73                  root))
74     root))
75
76 (let ((distr-in "c:/EmacsW32/nxhtml/tests/inemacs/"))
77   (when (file-directory-p distr-in)
78     (setq emacstest-files-root distr-in)))
79
80 (defun emacstest-run ()
81   "Run Emacs tests."
82   (interactive)
83   (setq message-log-max t)
84   (setq ert-test-files-root emacstest-files-root)
85   (let ((selector "emacs-"))
86     (if noninteractive
87         (ert-run-tests-batch selector)
88       (ert-kill-temp-test-buffers)
89       (ert-run-tests-interactively selector)
90       (other-window 1)
91       (ert-list-temp-test-buffers))))
92
93 (ert-deftest emacs-bug1013 ()
94   "Emacs bug 1013.
95 See URL
96 `http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1013'."
97   (ert-with-temp-buffer-include-file "bug1013.el"
98     (eval-buffer)))
99
100 (provide 'emacstest-suites)
101 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102 ;;; emacstest-suites.el ends here