]> git.rkrishnan.org Git - .emacs.d.git/blob - emacs/nxhtml/tests/nxhtmltest-Q.el
remove toolbar and menubar
[.emacs.d.git] / emacs / nxhtml / tests / nxhtmltest-Q.el
1 ;;; test-Q.el --- Run test from a fresh Emacs
2 ;;
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-07-08T23:05:40+0200 Tue
5 ;; Version: 0.1
6 ;; Last-Updated: 2008-07-09T00:17:26+0200 Tue
7 ;; URL:
8 ;; Keywords:
9 ;; Compatibility:
10 ;;
11 ;; Features that might be required by this library:
12 ;;
13 ;;   Required feature `test-Q' was not provided.
14 ;;
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ;;
17 ;;; Commentary:
18 ;;
19 ;; Defines `nxhtmltest-Q'.
20 ;;
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22 ;;
23 ;;; Change log:
24 ;;
25 ;;
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ;;
28 ;; This program is free software; you can redistribute it and/or
29 ;; modify it under the terms of the GNU General Public License as
30 ;; published by the Free Software Foundation; either version 2, or
31 ;; (at your option) any later version.
32 ;;
33 ;; This program is distributed in the hope that it will be useful,
34 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
35 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
36 ;; General Public License for more details.
37 ;;
38 ;; You should have received a copy of the GNU General Public License
39 ;; along with this program; see the file COPYING.  If not, write to
40 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
41 ;; Floor, Boston, MA 02110-1301, USA.
42 ;;
43 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
44 ;;
45 ;;; Code:
46
47 (eval-when-compile (require 'cl))
48 (eval-when-compile (require 'ourcomments-util))
49
50 (eval-and-compile
51   (defvar nxhtmltest-bin-Q
52     (file-name-directory (or load-file-name
53                              (when 'bytecomp-filename bytecomp-filename)
54                              buffer-file-name)))
55
56   (add-to-list 'load-path nxhtmltest-bin-Q)
57   (require 'nxhtmltest-helpers))
58
59 ;;;###autoload
60 (defun nxhtmltest-run-Q ()
61   "Run all tests defined for nXhtml in fresh Emacs.
62 See `nxhtmltest-run' for more information about the tests."
63   (interactive)
64   (let* ((test-el (expand-file-name "nxhtmltest-suites.el" nxhtmltest-bin-Q))
65          (nxhtml-auto-start (expand-file-name "../autostart.el" nxhtmltest-bin-Q))
66          (temp-eval-file (expand-file-name "temp-test.el" nxhtmltest-bin-Q))
67          (temp-eval-buf (find-file-noselect temp-eval-file))
68          (load-path load-path))
69     ;;(load (expand-file-name "nxhtmltest-helpers" nxhtmltest-bin-Q))
70     (add-to-list 'load-path nxhtmltest-bin-Q)
71     (require 'nxhtmltest-helpers)
72     (nxhtmltest-get-fontification-method)
73     (with-current-buffer temp-eval-buf
74       (erase-buffer)
75       (insert "(setq debug-on-error t)\n"
76               "(eval-when-compile (require 'cl))\n"
77               "(delete-other-windows)\n"
78               "(eval-after-load 'nxhtml '(setq nxhtml-skip-welcome t))\n"
79               (format "(setq nxhtmltest-default-fontification-method '%s)\n"
80                       nxhtmltest-default-fontification-method)
81               ))
82     (when (featurep 'ruby-mode)
83       (with-current-buffer temp-eval-buf
84         (insert "(pushnew \""
85                 (file-name-directory (locate-library "ruby-mode"))
86                 "\" load-path)")))
87     (with-current-buffer temp-eval-buf
88       (save-buffer))
89     (kill-buffer temp-eval-buf)
90     (unless (file-exists-p nxhtmltest-bin-Q)
91       (error "Can't find directory %s" nxhtmltest-bin-Q))
92     (setq nxhtmltest-bin-Q (file-name-sans-extension nxhtmltest-bin-Q))
93     (unless (file-exists-p test-el)
94       (error "Can't find file %s" test-el))
95     (setq test-el (file-name-sans-extension test-el))
96     (unless (file-exists-p nxhtml-auto-start)
97       (error "Can't find file %s" nxhtml-auto-start))
98     (setq nxhtml-auto-start (file-name-sans-extension nxhtml-auto-start))
99     (message "nxhtmltest-bin-Q=%s" nxhtmltest-bin-Q)
100     (message "nxhtml-auto-start=%s" nxhtml-auto-start)
101     (setenv "nxhtmltest-run-Q" "run")
102     (message "After setenv nxhtmltest-run-Q=%s" (getenv "nxhtmltest-run-Q"))
103     (message "(ourcomments-find-emacs) => %s" (ourcomments-find-emacs))
104     (call-process (ourcomments-find-emacs) nil 0 nil "-Q"
105                   "-l" temp-eval-file
106                   "-l" nxhtml-auto-start
107                   "-l" test-el)
108     (message "After call-process")
109     (setenv "nxhtmltest-run-Q")
110     (message "Starting new Emacs instance for test - it will be ready soon ...")))
111
112
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114 ;;; nxhtmltest-Q.el ends here