1 ;;; nxhtmltest-suites.el --- Test suites for mumamo / nXhtml
3 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
4 ;; Created: 2008-07-08T20:17:36+0200 Tue
6 ;; Last-Updated: 2008-09-01T01:13:28+0200 Sun
11 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
15 ;; Defines `nxhtmltest-run'. When (getenv "nxhtmltest-run-Q")
16 ;; returns non-nil also runs this function.
18 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22 ;; Added code from Christian Ohler for writing ert tests.
24 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26 ;; This program is free software; you can redistribute it and/or
27 ;; modify it under the terms of the GNU General Public License as
28 ;; published by the Free Software Foundation; either version 2, or
29 ;; (at your option) any later version.
31 ;; This program is distributed in the hope that it will be useful,
32 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
33 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 ;; General Public License for more details.
36 ;; You should have received a copy of the GNU General Public License
37 ;; along with this program; see the file COPYING. If not, write to
38 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
39 ;; Floor, Boston, MA 02110-1301, USA.
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45 ;;(eval-when-compile (require 'cl))
46 (eval-when-compile (require 'cl))
47 (eval-when-compile (require 'rng-valid))
48 (eval-when-compile (require 'rngalt))
52 (require 'nxhtml-mumamo)
53 (when (fboundp 'nxml-mode)
57 (setq debug-on-error t)
59 (defvar nxhtmltest-ert-default-selector "nxhtml-ert-"
60 "Set this to run a single test with `nxhtmltest-run-Q'.")
62 (defvar nxhtmltest-bin
63 (file-name-directory (if load-file-name load-file-name buffer-file-name)))
65 (pushnew nxhtmltest-bin load-path)
66 (require 'nxhtmltest-helpers)
69 (defvar nxhtmltest-files-root
70 (let* ((this-dir nxhtmltest-bin)
71 (root (expand-file-name "in/" this-dir)))
72 (unless (file-accessible-directory-p root)
73 (error (if (file-exists-p root)
74 "Can't read files in test directory %s"
75 "Can't find test directory %s")
79 (let ((distr-in "c:/EmacsW32/nxhtml/tests/in/"))
80 (when (file-directory-p distr-in)
81 (setq nxhtmltest-files-root distr-in)))
83 ;; (setq nxhtmltest-update-method
85 ;; 'font-lock-run-timers
86 ;; ;;'font-lock-fontify-buffer
89 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
90 ;; Define tests using ert.el
92 (ert-deftest nxhtml-ert-bug531328 ()
93 "Test of eRuby chunks with nothing between."
94 (ert-with-temp-buffer-include-file "bug531328.rhtml"
95 (add-hook 'ert-simulate-command-post-hook
96 'nxhtmltest-should-no-mumamo-errors
98 (ert-simulate-command '(eruby-html-mumamo-mode) t)
99 (nxhtmltest-get-fontification-method)
100 (nxhtmltest-fontify-default-way 2 "trans")
101 (ert-simulate-command '(goto-char 12) t)
102 (ert-should (eq major-mode 'ruby-mode))
105 (ert-deftest nxhtml-ert-indent-bug-johan-2010-02-17()
106 "Test of eRuby indentation.
107 Got a bug report by mail on the emacs-on-rails list."
108 (ert-with-temp-buffer-include-file "bug-johan-2010-02-17.erb"
109 (add-hook 'ert-simulate-command-post-hook
110 'nxhtmltest-should-no-mumamo-errors
112 (ert-simulate-command '(eruby-html-mumamo-mode) t)
113 (nxhtmltest-fontify-default-way 2 "trans")
114 (ert-simulate-command '(mark-whole-buffer) t)
115 (ert-simulate-command '(indent-for-tab-command) t)
116 (nxhtmltest-goto-line 1) (ert-should (= 0 (current-indentation)))
117 (nxhtmltest-goto-line 2) (ert-should (= 2 (current-indentation)))
118 (nxhtmltest-goto-line 3) (ert-should (= 0 (current-indentation)))
121 (ert-deftest nxhtml-ert-indent-bug-johan-2010-02-12()
122 "Test of eRuby indentation.
123 Got a bug report by mail on the emacs-on-rails list."
124 (ert-with-temp-buffer-include-file "bug-johan-2010-02-12.rhtml"
125 (add-hook 'ert-simulate-command-post-hook
126 'nxhtmltest-should-no-mumamo-errors
128 (ert-simulate-command '(eruby-html-mumamo-mode) t)
129 (nxhtmltest-fontify-default-way 2 "trans")
130 (ert-simulate-command '(mark-whole-buffer) t)
131 (ert-simulate-command '(indent-for-tab-command) t)
132 (nxhtmltest-goto-line 12) (ert-should (= 2 (current-indentation)))
135 ;;(setq nxhtmltest-ert-default-selector "nxhtml-ert-indent-rr-min8")
136 (ert-deftest nxhtml-ert-indent-rr-min8 ()
137 "Test of indentation bug.
138 As per Richard Riley's bug report 2009-10-08. Last line gave an
140 (ert-with-temp-buffer-include-file "rr-min8.php"
141 (add-hook 'ert-simulate-command-post-hook
142 'nxhtmltest-should-no-mumamo-errors
144 (ert-simulate-command '(nxhtml-mumamo-mode) t)
145 (nxhtmltest-fontify-default-way 2 "trans")
146 (ert-simulate-command '(mark-whole-buffer) t)
147 (ert-simulate-command '(indent-for-tab-command) t)))
149 ;;(setq nxhtmltest-ert-default-selector "nxhtml-ert-bug-400415")
150 (ert-deftest nxhtml-ert-bug-400415-foo2 ()
151 "Test for changes before in-here-doc using 400415.
152 See URL `https://bugs.launchpad.net/nxhtml/+bug/400415'. This is
153 not the bug reported there however."
154 (ert-with-temp-buffer-include-file "bug400415-foo2.php"
155 (add-hook 'ert-simulate-command-post-hook
156 'nxhtmltest-should-no-mumamo-errors
158 (ert-simulate-command '(nxhtml-mumamo-mode) t)
159 (nxhtmltest-fontify-default-way 2 "trans")
160 (ert-simulate-command '(goto-char 74) t)
161 (ert-should (eq major-mode 'sql-mode))
162 (ert-simulate-command '(goto-char 23) t)
163 (ert-simulate-command '(backward-delete-char-untabify 1) t)
164 (ert-simulate-command '(goto-char 74) t)
165 (ert-should (eq major-mode 'sql-mode))
168 (ert-deftest nxhtml-ert-bug-300946-index ()
169 "Test for bug 300946 in Launchpad.
170 See URL `https://bugs.launchpad.net/nxhtml/+bug/300946'. This is
171 a test for the file attached by Chris on 2008-12-02."
172 (ert-with-temp-buffer-include-file "bug-300946-index.html"
173 (add-hook 'ert-simulate-command-post-hook
174 'nxhtmltest-should-no-mumamo-errors
176 (ert-simulate-command '(nxhtml-mumamo-mode) t)
180 (ert-deftest nxhtml-ert-indent-bug290364 ()
181 "Test for bug 290364 in Launchpad.
182 See URL `https://bugs.launchpad.net/nxhtml/+bug/290364'.
184 Note: If this test fails Emacs loops. Therefore the whole test
185 is included in a when clause so you can avoid it easily."
187 (ert-with-temp-buffer-include-file "bug-290364.php"
188 (add-hook 'ert-simulate-command-post-hook
189 'nxhtmltest-should-no-mumamo-errors
191 (ert-simulate-command '(nxhtml-mumamo-mode) t)
196 (ert-deftest nxhtml-ert-indent-bug271497 ()
197 "Test for bug 271497 in Launchpad.
198 This is a bug in Emacs 22. It should work in Emacs 23 though.
199 See URL `https://bugs.launchpad.net/nxhtml/+bug/271497'."
200 (ert-with-temp-buffer-include-file "bug271497.txt"
201 (add-hook 'ert-simulate-command-post-hook
202 'nxhtmltest-should-no-mumamo-errors
204 (load-file (ert-get-test-file-name "bug271497.el"))
205 (ert-simulate-command '(bug271497-mumamo) t)
207 (nxhtmltest-fontify-default-way 2 "trans")
208 (ert-simulate-command '(goto-char 42) t)
209 (message "after goto-char 42")
210 (let ((ac42 after-change-functions)
212 (ert-simulate-command '(goto-char 88) t)
213 (message "after goto-char 88")
214 (setq ac88 after-change-functions)
215 (ert-should (not (equal ac88 ac42))))))
217 (ert-deftest nxhtml-ert-indent-question43320 ()
218 "Test for question 43320 in Launchpad.
219 See URL `https://answers.launchpad.net/nxhtml/+question/43320'.
221 Note: This fails in Emacs 22, but should work in Emacs 23."
222 ;; I did see some problem here:
224 ;; - nXhtml 081222 + unpatched Emacs 081219 => ok
225 ;; - nXhtml 081222 + unpatched Emacs 081124 => ok
226 ;; - nXhtml 081222 + patched Emacs 081219 => ok
228 ;; - nXhtml 081222 + patched Emacs 081124 => ok, but it fails if I
229 ;; use `nxhtmltest-run-Q'! I e, it fails if the autostart.el from
230 ;; the nxhtml dir in 081222 is used - but not if the copy in
231 ;; c:/EmacsW32 is used??? Which turned out to be if the old
232 ;; php-mode was used ...
234 (ert-with-temp-buffer-include-file "question43320.html"
235 (add-hook 'ert-simulate-command-post-hook
236 'nxhtmltest-should-no-mumamo-errors
238 (ert-simulate-command '(nxhtml-mumamo-mode) t)
240 (nxhtmltest-goto-line 25) (ert-should (/= 14 (current-indentation)))
241 (put 'mumamo-submode-indent-offset-0 'permanent-local t)
242 (put 'mumamo-submode-indent-offset 'permanent-local t)
244 ;;(set (make-local-variable 'mumamo-submode-indent-offset-0) nil)
245 (set (make-local-variable 'mumamo-submode-indent-offset-0) 0)
246 (set (make-local-variable 'mumamo-submode-indent-offset) nil)
247 ;;(set (make-local-variable 'mumamo-submode-indent-offset) 2)
248 (ert-simulate-command '(mark-whole-buffer) t)
249 (ert-simulate-command '(indent-for-tab-command) t)
250 (nxhtmltest-goto-line 8) (ert-should (= 8 (current-indentation)))
251 (nxhtmltest-goto-line 9) (ert-should (= 0 (current-indentation)))
252 (nxhtmltest-goto-line 15) (ert-should (= 8 (current-indentation)))
253 (nxhtmltest-goto-line 16) (ert-should (= 8 (current-indentation)))
254 (nxhtmltest-goto-line 22) (ert-should (= 6 (current-indentation)))
255 (nxhtmltest-goto-line 25) (ert-should (= 4 (current-indentation)))
256 (nxhtmltest-goto-line 8) (indent-line-to 0)
257 ;;(message "before indent-for-tab-command")
258 (ert-simulate-command '(indent-for-tab-command) t)
259 ;;(message "after indent-for-tab-command")
260 (ert-should (= 8 (current-indentation)))
262 (set (make-local-variable 'mumamo-submode-indent-offset-0) 0)
263 (set (make-local-variable 'mumamo-submode-indent-offset) 2)
264 (ert-simulate-command '(mark-whole-buffer) t)
265 (ert-simulate-command '(indent-for-tab-command) t)
266 (nxhtmltest-goto-line 8) (ert-should (= 8 (current-indentation)))
267 (nxhtmltest-goto-line 9) (ert-should (= 10 (current-indentation)))
268 (nxhtmltest-goto-line 15) (ert-should (= 8 (current-indentation)))
269 (nxhtmltest-goto-line 16) (ert-should (= 8 (current-indentation)))
270 (nxhtmltest-goto-line 22) (ert-should (= 16 (current-indentation)))
271 (nxhtmltest-goto-line 25) (ert-should (= 14 (current-indentation)))
274 (ert-deftest nxhtml-ert-only-php-no-end ()
275 "Check for nXml error."
276 (ert-with-temp-buffer-include-file "no-php-end-4.php"
278 (run-hooks 'after-change-major-mode-hook)
279 (run-hooks 'post-command-hook)
280 (nxhtmltest-fontify-default-way 2 "trans")
281 (rng-validate-mode 1)
283 (ert-should (eq rng-validate-mode t))
284 (nxhtmltest-should-no-mumamo-errors)
285 (nxhtmltest-should-no-nxml-errors)
287 (message "before insert, after-change-functions local=%s" after-change-functions)
289 (nxhtmltest-should-no-mumamo-errors)
290 (nxhtmltest-should-no-nxml-errors)))
292 (ert-deftest nxhtml-ert-xhtml-1.0-transitional ()
293 "Test XHTML 1.0 Transitional with `nxhtml-mumamo-mode'.
294 NOTICE: This test SHOULD FAIL because there is currently no rng
295 schema for transitional. The schema for strict is used instead
296 and the file is invalid then."
297 (ert-with-temp-buffer-include-file "lg-080813-label.html"
299 (nxhtmltest-fontify-default-way 2 "trans")
300 (rng-validate-mode 1)
302 (ert-should (eq rng-validate-mode t))
303 (nxhtmltest-should-no-mumamo-errors)
305 ;;; (not (eq (get-char-property 398 'category)
308 (eq (get-text-property 398 'face)
309 'font-lock-function-name-face))
311 (= 0 rng-error-count))
314 (ert-deftest nxhtml-ert-genshi-valid-in-genshi ()
315 (ert-with-temp-buffer-include-file "genshi-auto-mode.html"
317 (genshi-nxhtml-mumamo-mode)
319 (mumamo-post-command)
320 (ert-should (eq font-lock-mode t))
321 (ert-should (eq major-mode 'nxhtml-genshi-mode))
323 (memq mumamo-multi-major-mode '(genshi-nxhtml-mumamo-mode
324 genshi-html-mumamo-mode)))
325 (nxhtmltest-fontify-default-way 2 "sheit")
326 (rng-validate-mode 1)
328 (ert-should (eq rng-validate-mode t))
329 (nxhtmltest-should-no-mumamo-errors)
331 (= 0 rng-error-count))))
333 (ert-deftest nxhtml-ert-genshi-invalid-in-nxhtml ()
334 (ert-with-temp-buffer-include-file "genshi-auto-mode.html"
337 (nxhtmltest-fontify-default-way 2 "sheit")
339 (mumamo-post-command)
340 (rng-validate-mode 1)
342 (ert-should (eq rng-validate-mode t))
343 (nxhtmltest-should-no-mumamo-errors)
345 (= 2 rng-error-count))))
347 (ert-deftest nxhtml-ert-genshi-magic-mode ()
348 "Test if genshi file is recognized."
349 (let ((file1 (ert-get-test-file-name "genshi-auto-mode.html"))
351 ;; Ensure we open the files
352 (setq buf1 (find-buffer-visiting file1))
353 (when buf1 (kill-buffer buf1))
355 (setq buf1 (find-file file1))
356 (nxhtmltest-fontify-default-way 2 "mod")
357 (nxhtmltest-should-no-mumamo-errors)
359 (with-current-buffer buf1
360 (memq mumamo-multi-major-mode '(genshi-nxhtml-mumamo-mode
361 genshi-html-mumamo-mode))))
364 (ert-deftest nxhtml-ert-genshi-auto-mode ()
365 "Test if file extension .ghtml is recognized."
366 (let ((file1 (ert-get-test-file-name "genshi-HelloWorldPage.ghtml"))
368 ;; Ensure we open the files
369 (setq buf1 (find-buffer-visiting file1))
370 (when buf1 (kill-buffer buf1))
372 (setq buf1 (find-file file1))
373 (nxhtmltest-fontify-default-way 2 "mod")
374 (nxhtmltest-should-no-mumamo-errors)
376 (with-current-buffer buf1
377 (memq mumamo-multi-major-mode '(genshi-nxhtml-mumamo-mode
378 genshi-html-mumamo-mode))))
381 (ert-deftest nxhtml-ert-opened-modified ()
382 "Test if buffer get modified when opening a file."
383 (let ((file1 (ert-get-test-file-name "cvd-080805-ac.php"))
384 (file2 (ert-get-test-file-name "cvd-080805-cc.php"))
387 ;; Ensure we open the files
388 (setq buf1 (find-buffer-visiting file1))
389 (when buf1 (kill-buffer buf1))
390 (setq buf2 (find-buffer-visiting file2))
391 (when buf2 (kill-buffer buf2))
393 (setq buf1 (find-file file1))
394 (nxhtmltest-fontify-default-way 2 "mod")
395 (nxhtmltest-should-no-mumamo-errors)
397 (setq buf2 (find-file file2))
398 (nxhtmltest-fontify-default-way 2 "mod")
399 (nxhtmltest-should-no-mumamo-errors)
401 (not (or (buffer-modified-p buf1)
402 (buffer-modified-p buf2))))
406 (ert-deftest nxhtml-ert-wiki-strange-hili-080629 ()
407 "From a report on EmacsWiki."
408 (ert-with-temp-buffer-include-file "wiki-strange-hili-080629.html"
409 ;;(ert-should (not font-lock-mode))
411 ;;(ert-should (not font-lock-mode))
412 (nxhtmltest-fontify-default-way 2 "hili")
414 (nxhtmltest-should-no-mumamo-errors)
415 (message "face at 44=%s" (get-text-property 44 'face))
417 (eq (get-text-property 44 'face)
418 'font-lock-function-name-face))))
420 (ert-deftest nxhtml-ert-indent-wiki-080708-ind-problem ()
421 (ert-with-temp-buffer-include-file "wiki-080708-ind-problem.rhtml"
422 (require 'ruby-mode nil t)
423 (if (not (featurep 'ruby-mode))
424 ;; Fix-me: ert should maybe have some way to just display
425 ;; informational messages?
426 (error "ruby-mode not available, skipping test")
427 ;;(ert-should (not font-lock-mode))
428 (eruby-nxhtml-mumamo-mode)
429 ;;(ert-should (not font-lock-mode))
430 (nxhtmltest-fontify-default-way 2 "ind")
432 (indent-for-tab-command)
433 (nxhtmltest-goto-line 3)
434 (nxhtmltest-should-no-mumamo-errors)
435 (ert-should (= (current-indentation) 0)))))
437 (ert-deftest nxhtml-ert-indent-wiki-080708-ind-problem-a ()
438 "From a report on EmacsWiki.
439 NOTICE: This SHOULD FAIL. There is currently no support for the
440 kind of indentation needed here.
442 Notice 2: For some reason I sometimes get the error overlayp, nil
444 (ert-with-temp-buffer-include-file "wiki-080708-ind-problem.rhtml"
445 (require 'ruby-mode nil t)
446 (if (not (featurep 'ruby-mode))
447 (error "ruby-mode not available, skipping test")
448 ;;(ert-should (not font-lock-mode))
449 (eruby-nxhtml-mumamo-mode)
450 ;;(ert-should (not font-lock-mode))
451 (nxhtmltest-fontify-default-way 2 "ind")
454 (indent-for-tab-command)
455 (nxhtmltest-goto-line 3)
457 (nxhtmltest-should-no-mumamo-errors)
458 (ert-should-not (= (current-indentation) 2)))))
460 (ert-deftest nxhtml-ert-sheit-2007-12-26 ()
461 (ert-with-temp-buffer-include-file "sheit-2007-12-26.php"
462 ;;(ert-should (not font-lock-mode))
464 ;;(ert-should (not font-lock-mode))
465 (nxhtmltest-fontify-default-way 2 "sheit")
466 (nxhtmltest-should-no-mumamo-errors)
469 (eq (get-text-property 21 'face)
470 'font-lock-comment-face)
471 (eq (get-text-property 22 'face)
472 'font-lock-comment-face)
473 (eq (get-text-property 35 'face)
474 'font-lock-comment-face)))))
477 ;; Now some tests with a big file. Jumping backwards can fail.
479 (defun nxhtml-ert-nxhtml-changes-jump-back-2 (pos)
480 ;;(ert-should (not font-lock-mode))
482 (run-hooks 'post-command-hook)
483 ;;(ert-should (not font-lock-mode))
484 (goto-char (- (point-max) (- 64036 63869)))
485 (nxhtmltest-fontify-default-way 2)
486 (nxhtmltest-should-no-mumamo-errors)
488 (eq (get-text-property (point) 'face)
489 'font-lock-variable-name-face))
492 (nxhtmltest-fontify-default-way 2)
493 (nxhtmltest-should-no-mumamo-errors)
496 (eq (get-text-property (point) 'face)
497 'font-lock-function-name-face)))
499 ;; Fix-me: forgot to copy nxhtml-changes.html. I can't find any
500 ;; similar error now.
502 ;; (ert-deftest nxhtml-ert-nxhtml-changes-jump-back-7014-2 ()
503 ;; "this is a docstring.
504 ;; wonder how that works now ..."
505 ;; (ert-with-temp-buffer-include-file "../../nxhtml/doc/nxhtml-changes.html"
506 ;; (nxhtml-ert-nxhtml-changes-jump-back-2 7014)))
508 ;; (ert-deftest nxhtml-ert-nxhtml-changes-jump-back-10488-2 ()
509 ;; (ert-with-temp-buffer-include-file "../../nxhtml/doc/nxhtml-changes.html"
510 ;; (nxhtml-ert-nxhtml-changes-jump-back-2 10488)))
512 ;; (ert-deftest nxhtml-ert-nxhtml-changes-jump-2 ()
513 ;; (ert-with-temp-buffer-include-file "../../nxhtml/doc/nxhtml-changes.html"
514 ;; ;;(ert-should (not font-lock-mode))
515 ;; (nxhtml-mumamo-mode)
516 ;; ;;(ert-should (not font-lock-mode))
518 ;; (nxhtmltest-fontify-default-way 2 "jump-2")
519 ;; (nxhtmltest-should-no-mumamo-errors)
521 ;; (eq (get-text-property (point) 'face)
522 ;; 'font-lock-variable-name-face))))
524 ;;; Indentation tests
526 (ert-deftest nxhtml-ert-php-indent-bug-1 ()
527 "Test indentation in php only file.
528 The indentation on line 7 should be 0."
529 (ert-with-temp-buffer-include-file "only-php.php"
531 ;; No fontification needed for indentation.
532 (nxhtmltest-goto-line 7)
533 (indent-for-tab-command)
534 (nxhtmltest-should-no-mumamo-errors)
537 (current-indentation)))))
541 ;; (ert-deftest nxhtml-ert-scroll-jump-test ()
542 ;; "Test if `scroll-conservatively' eq 1 works."
543 ;; (ert-with-temp-buffer-include-file "../../nxhtml/doc/nxhtml-changes.html"
544 ;; (ert-should (not font-lock-mode))
545 ;; (nxhtml-mumamo-mode)
546 ;; (ert-should (not font-lock-mode))
547 ;; (nxhtmltest-fontify-default-way 2 "jump-2")
548 ;; (let ((scroll-conservatively 1)
549 ;; (ws (list (window-start)))
550 ;; (xi (loop for ii from 1 to 100 by 1
554 ;; collect (list (window-start)
555 ;; (let ((here (point)))
556 ;; (goto-char (window-start))
557 ;; (prog1 (line-end-position)
558 ;; (goto-char here)))
565 ;; (loop for xx in xi
567 ;; (message "xx=%s" xx)
568 ;; (let ((win-start (nth 0 xx))
569 ;; (win-start-le (nth 1 xx))
570 ;; (cur-point (nth 2 xx)))
571 ;; (unless (or (not prev-win-start)
572 ;; (= prev-win-start win-start)
573 ;; (= (1+ prev-win-start-le) win-start))
574 ;; (setq jumps (1+ jumps)))
575 ;; (setq prev-win-start win-start)
576 ;; (setq prev-win-start-le win-start-le)
579 ;; (ert-should (= 0 jumps))
582 ;;(defvar ert-error-on-test-redefinition nil)
584 ;;; End of test definitions
585 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
587 (defun nxhtmltest-run-ert (selector)
588 "Run test with ert library."
589 (unless selector (setq selector nxhtmltest-ert-default-selector))
590 (setq ert-test-files-root nxhtmltest-files-root)
592 (ert-run-tests-batch selector)
593 (ert-kill-temp-test-buffers)
594 (ert-run-tests-interactively selector)
596 (ert-list-temp-test-buffers)))
599 (defun nxhtmltest-run-indent ()
600 "Run indentation tests."
602 (setq ert-test-files-root nxhtmltest-files-root)
603 (let ((selector "nxhtml-ert-indent-"))
604 (ert-kill-temp-test-buffers)
605 (nxhtmltest-get-fontification-method)
606 (ert-run-tests-interactively selector))
608 (ert-list-temp-test-buffers))
611 (defun nxhtmltest-run ()
612 "Run all tests defined for nXhtml.
613 Currently there are only tests using ert.el defined.
615 Note that it is currently expected that the following tests will
616 fail (they corresponds to known errors in nXhtml/Emacs):
618 `nxhtml-ert-nxhtml-changes-jump-back-10549'
619 `nxhtml-ert-nxhtml-changes-jump-back-7014'
622 (setq message-log-max t)
623 (when (called-interactively-p)
624 (nxhtmltest-get-fontification-method))
625 (nxhtmltest-run-ert nil))
627 (when (getenv "nxhtmltest-run-Q")
630 (provide 'nxhtmltest-suites)
631 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
632 ;;; nxhtmltest-suites.el ends here