Merge branch 'smarter_error_list'

db4
Slava Pestov 2009-04-17 15:50:36 -05:00
commit 99a120a146
8 changed files with 24 additions and 30 deletions

View File

@ -8,7 +8,7 @@ namespaces eval kernel vocabs.loader io ;
(command-line) parse-command-line (command-line) parse-command-line
load-vocab-roots load-vocab-roots
run-user-init run-user-init
"e" get [ eval ] when* "e" get [ eval( -- ) ] when*
ignore-cli-args? not script get and ignore-cli-args? not script get and
[ run-script ] [ "run" get run ] if* [ run-script ] [ "run" get run ] if*
output-stream get [ stream-flush ] when* output-stream get [ stream-flush ] when*

View File

@ -17,13 +17,13 @@ sequences accessors tools.test kernel math ;
[ 2 ] [ [ 3 [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test [ 2 ] [ [ 3 [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
: foo ( a b -- b a ) swap ; inline recursive : foo ( quot: ( -- ) -- ) call ; inline recursive
: recursive-inputs ( nodes -- n ) : recursive-inputs ( nodes -- n )
[ #recursive? ] find nip child>> first in-d>> length ; [ #recursive? ] find nip child>> first in-d>> length ;
[ 0 2 ] [ [ 1 3 ] [
[ foo ] build-tree [ [ swap ] foo ] build-tree
[ recursive-inputs ] [ recursive-inputs ]
[ analyze-recursive normalize recursive-inputs ] bi [ analyze-recursive normalize recursive-inputs ] bi
] unit-test ] unit-test

View File

@ -1,4 +1,6 @@
IN: eval.tests IN: eval.tests
USING: eval tools.test ; USING: eval tools.test ;
[ 4 ] [ "USE: math 2 2 +" eval( -- result ) ] unit-test
[ "USE: math 2 2 +" eval( -- ) ] must-fail
[ "4\n" ] [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-test [ "4\n" ] [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-test

View File

@ -2,8 +2,8 @@ USING: arrays definitions io.streams.string io.streams.duplex
kernel math namespaces parser prettyprint prettyprint.config kernel math namespaces parser prettyprint prettyprint.config
prettyprint.sections sequences tools.test vectors words prettyprint.sections sequences tools.test vectors words
effects splitting generic.standard prettyprint.private effects splitting generic.standard prettyprint.private
continuations generic compiler.units tools.walker eval continuations generic compiler.units tools.continuations
accessors make vocabs.parser see ; tools.continuations.private eval accessors make vocabs.parser see ;
IN: prettyprint.tests IN: prettyprint.tests
[ "4" ] [ 4 unparse ] unit-test [ "4" ] [ 4 unparse ] unit-test

View File

@ -7,29 +7,21 @@ IN: tools.errors
#! Tools for source-files.errors. Used by tools.tests and others #! Tools for source-files.errors. Used by tools.tests and others
#! for error reporting #! for error reporting
M: source-file-error summary
error>> summary ;
M: source-file-error compute-restarts M: source-file-error compute-restarts
error>> compute-restarts ; error>> compute-restarts ;
M: source-file-error error-help M: source-file-error error-help
error>> error-help ; error>> error-help ;
M: source-file-error error. M: source-file-error summary
[ [
[ [ file>> [ % ": " % ] [ "<Listener input>" % ] if* ]
[ [ line#>> [ # ] when* ] bi
[ file>> [ % ": " % ] when* ] ] "" make
[ line#>> [ # "\n" % ] when* ] bi ;
] "" make
] [ M: source-file-error error.
[ [ summary print nl ] [ error>> error. ] bi ;
presented set
bold font-style set
] H{ } make-assoc
] bi format
] [ error>> error. ] bi ;
: errors. ( errors -- ) : errors. ( errors -- )
group-by-source-file sort-errors group-by-source-file sort-errors

View File

@ -129,13 +129,13 @@ TEST: must-infer
TEST: must-fail-with TEST: must-fail-with
TEST: must-fail TEST: must-fail
M: test-failure summary
asset>> [ [ experiment. ] with-string-writer ] [ "Top-level form" ] if* ;
M: test-failure error. ( error -- ) M: test-failure error. ( error -- )
[ call-next-method ] {
[ traceback-button. ] [ summary print nl ]
bi ; [ asset>> [ experiment. nl ] when* ]
[ error>> error. ]
[ traceback-button. ]
} cleave ;
: :test-failures ( -- ) test-failures get errors. ; : :test-failures ( -- ) test-failures get errors. ;

View File

@ -27,7 +27,7 @@ INSTANCE: fake-break word-break
[ { 0 0 } ] [ "a" get loc>> ] unit-test [ { 0 0 } ] [ "a" get loc>> ] unit-test
[ { 45 15 } ] [ "b" get loc>> ] unit-test [ { 45 7 } ] [ "b" get loc>> ] unit-test
[ { 0 30 } ] [ "c" get loc>> ] unit-test [ { 0 30 } ] [ "c" get loc>> ] unit-test

View File

@ -80,7 +80,7 @@ M: error-renderer row-columns
{ {
[ error-type error-icon ] [ error-type error-icon ]
[ line#>> [ number>string ] [ "" ] if* ] [ line#>> [ number>string ] [ "" ] if* ]
[ asset>> unparse-short ] [ asset>> [ unparse-short ] [ "" ] if* ]
[ error>> summary ] [ error>> summary ]
} cleave } cleave
] output>array ; ] output>array ;