chiark / gitweb /
src/final.lisp (test-module): Make it useful for testing error reporting.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Jun 2018 18:58:28 +0000 (19:58 +0100)
src/final.lisp

index 510a0a87064c03c99e3aad201325178a79585108..ee75705ceb4ff4898794e38f7af75ebc0f67bb48 100644 (file)
@@ -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)