From 3178259703980c111c7b56acf8bff08cbb258a49 Mon Sep 17 00:00:00 2001 Message-Id: <3178259703980c111c7b56acf8bff08cbb258a49.1715428815.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] src/final.lisp (test-module): Make it useful for testing error reporting. Organization: Straylight/Edgeware From: Mark Wooding --- src/final.lisp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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) -- [mdw]