More fixes

db4
Slava Pestov 2008-06-25 04:06:18 -05:00
parent cf345df3f5
commit 666d4abaee
9 changed files with 24 additions and 27 deletions

View File

@ -198,7 +198,7 @@ IN: parser.tests
[ [
"IN: parser.tests : x ; : y 3 throw ; this is an error" "IN: parser.tests : x ; : y 3 throw ; this is an error"
<string-reader> "a" parse-stream <string-reader> "a" parse-stream
] [ parse-error? ] must-fail-with ] [ source-file-error? ] must-fail-with
[ t ] [ [ t ] [
"y" "parser.tests" lookup >boolean "y" "parser.tests" lookup >boolean
@ -298,12 +298,12 @@ IN: parser.tests
[ [
"IN: parser.tests TUPLE: another-pred-test ; GENERIC: another-pred-test?" "IN: parser.tests TUPLE: another-pred-test ; GENERIC: another-pred-test?"
<string-reader> "removing-the-predicate" parse-stream <string-reader> "removing-the-predicate" parse-stream
] [ error>> error>> redefine-error? ] must-fail-with ] [ error>> error>> error>> redefine-error? ] must-fail-with
[ [
"IN: parser.tests TUPLE: class-redef-test ; TUPLE: class-redef-test ;" "IN: parser.tests TUPLE: class-redef-test ; TUPLE: class-redef-test ;"
<string-reader> "redefining-a-class-1" parse-stream <string-reader> "redefining-a-class-1" parse-stream
] [ error>> error>> redefine-error? ] must-fail-with ] [ error>> error>> error>> redefine-error? ] must-fail-with
[ ] [ [ ] [
"IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test" "IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test"
@ -313,7 +313,7 @@ IN: parser.tests
[ [
"IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test : class-redef-test ;" "IN: parser.tests TUPLE: class-redef-test ; SYMBOL: class-redef-test : class-redef-test ;"
<string-reader> "redefining-a-class-3" parse-stream drop <string-reader> "redefining-a-class-3" parse-stream drop
] [ error>> error>> redefine-error? ] must-fail-with ] [ error>> error>> error>> redefine-error? ] must-fail-with
[ ] [ [ ] [
"IN: parser.tests TUPLE: class-fwd-test ;" "IN: parser.tests TUPLE: class-fwd-test ;"
@ -323,7 +323,7 @@ IN: parser.tests
[ [
"IN: parser.tests \\ class-fwd-test" "IN: parser.tests \\ class-fwd-test"
<string-reader> "redefining-a-class-3" parse-stream drop <string-reader> "redefining-a-class-3" parse-stream drop
] [ error>> error>> no-word-error? ] must-fail-with ] [ error>> error>> error>> no-word-error? ] must-fail-with
[ ] [ [ ] [
"IN: parser.tests TUPLE: class-fwd-test ; SYMBOL: class-fwd-test" "IN: parser.tests TUPLE: class-fwd-test ; SYMBOL: class-fwd-test"
@ -333,12 +333,12 @@ IN: parser.tests
[ [
"IN: parser.tests \\ class-fwd-test" "IN: parser.tests \\ class-fwd-test"
<string-reader> "redefining-a-class-3" parse-stream drop <string-reader> "redefining-a-class-3" parse-stream drop
] [ error>> error>> no-word-error? ] must-fail-with ] [ error>> error>> error>> no-word-error? ] must-fail-with
[ [
"IN: parser.tests : foo ; TUPLE: foo ;" "IN: parser.tests : foo ; TUPLE: foo ;"
<string-reader> "redefining-a-class-4" parse-stream drop <string-reader> "redefining-a-class-4" parse-stream drop
] [ error>> error>> redefine-error? ] must-fail-with ] [ error>> error>> error>> redefine-error? ] must-fail-with
[ ] [ [ ] [
"IN: parser.tests : foo ( x y -- z ) 1 2 ; : bar ( a -- b ) ;" eval "IN: parser.tests : foo ( x y -- z ) 1 2 ; : bar ( a -- b ) ;" eval

View File

@ -24,12 +24,8 @@ t parser-notes set-global
: note. ( str -- ) : note. ( str -- )
parser-notes? [ parser-notes? [
file get file. file get [ file. ] when*
lexer get [ lexer get line>> number>string write ": " write
lexer-line number>string print
] [
nl
] if*
"Note: " write dup print "Note: " write dup print
] when drop ; ] when drop ;

View File

@ -167,9 +167,11 @@ unit-test
"another-retain-layout" another-retain-layout-test check-see "another-retain-layout" another-retain-layout-test check-see
] unit-test ] unit-test
DEFER: parse-error-file
: another-soft-break-test : another-soft-break-test
{ {
"USING: namespaces parser sequences ;" "USING: namespaces sequences ;"
"IN: prettyprint.tests" "IN: prettyprint.tests"
": another-soft-break-layout ( node -- quot )" ": another-soft-break-layout ( node -- quot )"
" parse-error-file" " parse-error-file"
@ -183,7 +185,7 @@ unit-test
: string-layout : string-layout
{ {
"USING: io kernel parser ;" "USING: io kernel lexer ;"
"IN: prettyprint.tests" "IN: prettyprint.tests"
": string-layout-test ( error -- )" ": string-layout-test ( error -- )"
" \"Expected \" write dup unexpected-want expected>string write" " \"Expected \" write dup unexpected-want expected>string write"

View File

@ -82,11 +82,10 @@ TUPLE: source-file-error file error ;
file get >>file file get >>file
swap >>error ; swap >>error ;
: file. ( file -- ) path>> <pathname> pprint ; : file. ( file -- ) path>> <pathname> . ;
M: source-file-error error. M: source-file-error error.
"Error while parsing " write [ file>> file. ] [ error>> error. ] bi ;
[ file>> file. nl ] [ error>> error. ] bi ;
M: source-file-error summary M: source-file-error summary
error>> summary ; error>> summary ;

View File

@ -68,7 +68,7 @@ IN: vocabs.loader.tests
<string-reader> <string-reader>
"resource:core/vocabs/loader/test/a/a.factor" "resource:core/vocabs/loader/test/a/a.factor"
parse-stream parse-stream
] [ error>> error>> no-word-error? ] must-fail-with ] [ error>> error>> error>> no-word-error? ] must-fail-with
0 "count-me" set-global 0 "count-me" set-global

View File

@ -1,8 +1,8 @@
USING: http tools.test multiline tuple-syntax USING: http tools.test multiline tuple-syntax io.streams.string
io.streams.string io.encodings.utf8 io.encodings.string io.encodings.utf8 io.encodings.8-bit io.encodings.binary
kernel arrays splitting sequences io.encodings.string kernel arrays splitting sequences assocs
assocs io.sockets db db.sqlite continuations urls hashtables io.sockets db db.sqlite continuations urls hashtables accessors
accessors ; ;
IN: http.tests IN: http.tests
[ "text/plain" latin1 ] [ "text/plain" parse-content-type ] unit-test [ "text/plain" latin1 ] [ "text/plain" parse-content-type ] unit-test

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel opengl.gl alien.c-types continuations namespaces USING: kernel opengl.gl alien.c-types continuations namespaces
assocs alien alien.strings libc opengl math sequences combinators assocs alien alien.strings libc opengl math sequences combinators
macros arrays io.encodings.ascii ; combinators.lib macros arrays io.encodings.ascii ;
IN: opengl.shaders IN: opengl.shaders
: with-gl-shader-source-ptr ( string quot -- ) : with-gl-shader-source-ptr ( string quot -- )

View File

@ -17,7 +17,7 @@ IN: unicode.collation.tests
: test-equality : test-equality
{ primary= secondary= tertiary= quaternary= } { primary= secondary= tertiary= quaternary= }
[ execute ] 2with each ; [ execute ] with with each ;
[ f f f f ] [ "hello" "hi" test-equality ] unit-test [ f f f f ] [ "hello" "hi" test-equality ] unit-test
[ t f f f ] [ "hello" "h\u0000e9llo" test-equality ] unit-test [ t f f f ] [ "hello" "h\u0000e9llo" test-equality ] unit-test

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Doug Coleman. ! Copyright (C) 2007 Doug Coleman.
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: math.ranges sequences random accessors USING: math.ranges sequences random accessors combinators.lib
kernel namespaces fry db.types db.tuples urls validators kernel namespaces fry db.types db.tuples urls validators
html.components html.forms http http.server.dispatchers furnace html.components html.forms http http.server.dispatchers furnace
furnace.actions furnace.boilerplate furnace.redirection ; furnace.actions furnace.boilerplate furnace.redirection ;