From 50ed1f5a9f12a18462afa6d7d2e802724a4183c6 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 17 Apr 2009 15:50:11 -0500 Subject: [PATCH] Better error printing --- basis/tools/errors/errors.factor | 24 ++++++++---------------- basis/tools/test/test.factor | 12 ++++++------ 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/basis/tools/errors/errors.factor b/basis/tools/errors/errors.factor index a8708fd229..b4b6a3ec1e 100644 --- a/basis/tools/errors/errors.factor +++ b/basis/tools/errors/errors.factor @@ -7,29 +7,21 @@ IN: tools.errors #! Tools for source-files.errors. Used by tools.tests and others #! for error reporting -M: source-file-error summary - error>> summary ; - M: source-file-error compute-restarts error>> compute-restarts ; M: source-file-error error-help error>> error-help ; -M: source-file-error error. +M: source-file-error summary [ - [ - [ - [ file>> [ % ": " % ] when* ] - [ line#>> [ # "\n" % ] when* ] bi - ] "" make - ] [ - [ - presented set - bold font-style set - ] H{ } make-assoc - ] bi format - ] [ error>> error. ] bi ; + [ file>> [ % ": " % ] [ "" % ] if* ] + [ line#>> [ # ] when* ] bi + ] "" make + ; + +M: source-file-error error. + [ summary print nl ] [ error>> error. ] bi ; : errors. ( errors -- ) group-by-source-file sort-errors diff --git a/basis/tools/test/test.factor b/basis/tools/test/test.factor index 0741b90984..b98f58b143 100644 --- a/basis/tools/test/test.factor +++ b/basis/tools/test/test.factor @@ -129,13 +129,13 @@ TEST: must-infer TEST: must-fail-with TEST: must-fail -M: test-failure summary - asset>> [ [ experiment. ] with-string-writer ] [ "Top-level form" ] if* ; - M: test-failure error. ( error -- ) - [ call-next-method ] - [ traceback-button. ] - bi ; + { + [ summary print nl ] + [ asset>> [ experiment. nl ] when* ] + [ error>> error. ] + [ traceback-button. ] + } cleave ; : :test-failures ( -- ) test-failures get errors. ;