Skip to content

Commit 97d86cd

Browse files
committed
Tweak test runner
1 parent b6512fa commit 97d86cd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

test/swift-mode-test-indent.el

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
"Initialize and switch to the error buffer.
4242
4343
Return the error-buffer"
44-
(switch-to-buffer (get-buffer-create "*swift-mode-test-indent*"))
44+
(pop-to-buffer (get-buffer-create "*swift-mode-test-indent*"))
4545
(fundamental-mode)
4646
(setq buffer-read-only nil)
4747
(erase-buffer)
4848
(current-buffer))
4949

5050
(defun swift-mode:run-test:indent ()
51-
"Run indentation test for swift-mode."
51+
"Run indentation test for `swift-mode'."
5252
(interactive)
5353
(let ((error-buffer
5454
(if noninteractive nil (swift-mode:setup-error-buffer)))
@@ -57,18 +57,23 @@ Return the error-buffer"
5757
(cons 'error 0)
5858
(cons 'warning 0)
5959
(cons 'info 0)
60-
(cons 'ok 0))))
60+
(cons 'ok 0)))
61+
(progress-reporter (unless noninteractive
62+
(make-progress-reporter "Running tests..."))))
6163
(setq default-directory
6264
(concat (file-name-as-directory swift-mode:test:basedir)
6365
"swift-files"))
6466

6567
(dolist (swift-file (file-expand-wildcards "*.swift"))
68+
(redisplay)
6669
(with-temp-buffer
6770
(switch-to-buffer (current-buffer))
6871
(insert-file-contents-literally swift-file)
6972
(swift-mode)
7073
(setq current-line 0)
7174
(while (not (eobp))
75+
(when (not noninteractive)
76+
(progress-reporter-update progress-reporter))
7277
(setq current-line (1+ current-line))
7378
(cond
7479
((looking-at ".*//.*swift-mode:test:keep-indent")
@@ -88,6 +93,9 @@ Return the error-buffer"
8893
(setcdr count-assoc (1+ (cdr count-assoc))))))
8994
(forward-line))))
9095

96+
(when (not noninteractive)
97+
(progress-reporter-done progress-reporter))
98+
9199
(swift-mode:print-message
92100
error-buffer
93101
(concat
@@ -174,6 +182,7 @@ Otherwise, MESSAGE is appended to the ERROR-BUFFER."
174182
(if noninteractive
175183
(princ message)
176184
(with-current-buffer error-buffer
185+
(goto-char (point-max))
177186
(insert-and-inherit message))))
178187

179188
(provide 'swift-mode-test-indent)

0 commit comments

Comments
 (0)