@@ -53,7 +53,7 @@ Return the error-buffer"
5353 (let ((error-buffer
5454 (if noninteractive nil (swift-mode:setup-error-buffer)))
5555 (current-line 0 )
56- (error-count 0 ))
56+ (error-counts '(( error . 0 ) ( warning . 0 ) ( info . 0 ) (ok . 0 )) ))
5757 (setq default-directory
5858 (concat (file-name-as-directory swift-mode:test:basedir)
5959 " swift-files" ))
@@ -77,14 +77,23 @@ Return the error-buffer"
7777 (t
7878 (when (looking-at " .*//.*swift-mode:test:eval\\ (.*\\ )" )
7979 (eval-region (match-beginning 1 ) (match-end 1 )))
80- (unless
81- (swift-mode:test-current-line-indent
82- swift-file current-line error-buffer)
83- (setq error-count (1+ error-count)))))
80+ (let*
81+ ((status (swift-mode:test-current-line-indent
82+ swift-file current-line error-buffer))
83+ (count-assoc (assq status error-counts)))
84+ (setcdr count-assoc (1+ (cdr count-assoc))))))
8485 (forward-line ))))
85- (when (= error-count 0 )
86- (swift-mode:print-message error-buffer " no regressions\n " ))
87- (when (not noninteractive)
86+
87+ (swift-mode:print-message
88+ error-buffer
89+ (concat
90+ " Errors: " (prin1-to-string (assoc-default 'error error-counts)) " \n "
91+ " Warning: " (prin1-to-string (assoc-default 'warning error-counts)) " \n "
92+ " Info: " (prin1-to-string (assoc-default 'info error-counts)) " \n "
93+ " OK: " (prin1-to-string (assoc-default 'ok error-counts)) " \n " ))
94+
95+ (if noninteractive
96+ (kill-emacs (min 63 (assoc-default 'error error-counts)))
8897 (compilation-mode ))))
8998
9099(defun swift-mode:test-current-line-indent
@@ -97,7 +106,8 @@ ERROR-BUFFER is the buffer to output errors."
97106 (back-to-indentation )
98107 (let ((original-indent (current-column ))
99108 computed-indent
100- (known-bug (looking-at " .*//.*swift-mode:test:known-bug" )))
109+ (known-bug (looking-at " .*//.*swift-mode:test:known-bug" ))
110+ (status 'ok ))
101111 (delete-horizontal-space )
102112 (when (= original-indent 0 )
103113 (indent-line-to 1 ))
@@ -108,6 +118,8 @@ ERROR-BUFFER is the buffer to output errors."
108118 (indent-line-to original-indent)
109119
110120 (when (/= original-indent computed-indent)
121+ (setq status (if known-bug 'warning 'error ))
122+
111123 (swift-mode:show-error
112124 error-buffer swift-file current-line
113125 (if known-bug " warning" " error" )
@@ -119,12 +131,13 @@ ERROR-BUFFER is the buffer to output errors."
119131 (prin1-to-string computed-indent))))
120132
121133 (when (and (= original-indent computed-indent) known-bug)
134+ (setq status 'info )
122135 (swift-mode:show-error
123136 error-buffer swift-file current-line
124137 " info"
125138 " known-bug is fixed somehow" ))
126139
127- ( = original-indent computed-indent) ))
140+ status ))
128141
129142(defun swift-mode:show-error (error-buffer file line level message )
130143 " Show an error message to the ERROR-BUFFER or stdout.
0 commit comments