##// END OF EJS Templates
tests: add test for hg-test-mode emacs code...
Augie Fackler -
r41954:19979b8b default
parent child Browse files
Show More
@@ -0,0 +1,8
1 #require emacs
2 $ emacs -q -no-site-file -batch -l $TESTDIR/../contrib/hg-test-mode.el \
3 > -f ert-run-tests-batch-and-exit
4 Running 1 tests (*) (glob)
5 passed 1/1 hg-test-mode--compilation-mode-support
6
7 Ran 1 tests, 1 results as expected (*) (glob)
8
@@ -65,4 +65,33
65 "\\+ \\([^:\n]+\\):\\([0-9]+\\):$" 1 2))
65 "\\+ \\([^:\n]+\\):\\([0-9]+\\):$" 1 2))
66 (add-to-list 'compilation-error-regexp-alist 'hg-test-check-code-output))
66 (add-to-list 'compilation-error-regexp-alist 'hg-test-check-code-output))
67
67
68 (defun hg-test-mode--test-one-error-line-regexp (test)
69 (erase-buffer)
70 (setq compilation-locs (make-hash-table))
71 (insert (car test))
72 (compilation-parse-errors (point-min) (point-max))
73 (let ((msg (get-text-property 1 'compilation-message)))
74 (should msg)
75 (let ((loc (compilation--message->loc msg))
76 (line (nth 1 test))
77 (file (nth 2 test)))
78 (should (equal (compilation--loc->line loc) line))
79 (should (equal (caar (compilation--loc->file-struct loc)) file)))
80 msg))
81
82 (require 'ert)
83 (ert-deftest hg-test-mode--compilation-mode-support ()
84 "Test hg-specific compilation-mode regular expressions"
85 (require 'compile)
86 (with-temp-buffer
87 (font-lock-mode -1)
88 (mapc 'hg-test-mode--test-one-error-line-regexp
89 '(
90 ("+ contrib/debugshell.py:37:" 37 "contrib/debugshell.py")
91 ("+ File \"/tmp/hg/mercurial/commands.py\", line 3115, in help_"
92 3115 "/tmp/hg/mercurial/commands.py")
93 ("+ File \"mercurial/dispatch.py\", line 225, in dispatch"
94 225 "mercurial/dispatch.py")))))
95
96
68 (provide 'hg-test-mode)
97 (provide 'hg-test-mode)
General Comments 0
You need to be logged in to leave comments. Login now