From: Mark Wooding Date: Thu, 26 May 2016 08:26:09 +0000 (+0100) Subject: src/final.lisp (test-module): Make it useful for testing error reporting. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/3178259703980c111c7b56acf8bff08cbb258a49 src/final.lisp (test-module): Make it useful for testing error reporting. --- diff --git a/src/final.lisp b/src/final.lisp index 510a0a8..ee75705 100644 --- a/src/final.lisp +++ b/src/final.lisp @@ -42,11 +42,15 @@ (export 'test-module) (defun test-module (path reason) "Reset the translator's state, read a module from PATH and output it with REASON, returning the result as a string." - (with-open-file (out *debugout-pathname* - :direction :output - :if-exists :supersede - :if-does-not-exist :create) - (output-module (read-module path) reason out))) + (multiple-value-bind (module nerror nwarning) + (count-and-report-errors () (read-module path)) + (when reason + (with-open-file (out *debugout-pathname* + :direction :output + :if-exists :supersede + :if-does-not-exist :create) + (output-module module reason out))) + (list nerror nwarning))) (export 'test-parse-c-type) (defun test-parse-c-type (string)