1 ;;; test-Q.el --- Run test from a fresh Emacs
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-07-08T23:05:40+0200 Tue
6 ;; Last-Updated: 2008-07-09T00:17:26+0200 Tue
11 ;; Features that might be required by this library:
13 ;; Required feature `test-Q' was not provided.
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19 ;; Defines `nxhtmltest-Q'.
21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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.
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.
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.
43 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
47 (eval-when-compile (require 'cl))
48 (eval-when-compile (require 'ourcomments-util))
51 (defvar nxhtmltest-bin-Q
52 (file-name-directory (or load-file-name
53 (when 'bytecomp-filename bytecomp-filename)
56 (add-to-list 'load-path nxhtmltest-bin-Q)
57 (require 'nxhtmltest-helpers))
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."
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
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)
82 (when (featurep 'ruby-mode)
83 (with-current-buffer temp-eval-buf
85 (file-name-directory (locate-library "ruby-mode"))
87 (with-current-buffer temp-eval-buf
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"
106 "-l" nxhtml-auto-start
108 (message "After call-process")
109 (setenv "nxhtmltest-run-Q")
110 (message "Starting new Emacs instance for test - it will be ready soon ...")))
113 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114 ;;; nxhtmltest-Q.el ends here