Unit test fixes

db4
Slava Pestov 2007-12-30 17:14:15 -05:00
parent af41a0efe7
commit 64b06f059a
13 changed files with 27 additions and 24 deletions

View File

@ -1,5 +1,6 @@
IN: temporary
USING: bootstrap.image tools.test.infer ;
USING: bootstrap.image bootstrap.image.private
tools.test.inference ;
\ ' must-infer
\ write-image must-infer

View File

@ -62,7 +62,7 @@ UNION: bah fixnum alien ;
[ bah ] [ \ bah? "predicating" word-prop ] unit-test
! Test generic see and parsing
[ "IN: temporary\nSYMBOL: bah\n\nUNION: bah fixnum alien ;\n" ]
[ "USING: alien math ;\nIN: temporary\nUNION: bah fixnum alien ;\n" ]
[ [ \ bah see ] string-out ] unit-test
! Test redefinition of classes

View File

@ -120,8 +120,6 @@ TUPLE: delegating ;
[ t ] [ \ + math-generic? ] unit-test
[ "SYMBOL: not-a-class C: not-a-class ;" eval ] unit-test-fails
! Test math-combination
[ [ [ >float ] dip ] ] [ \ real \ float math-upgrade ] unit-test
[ [ >float ] ] [ \ float \ real math-upgrade ] unit-test

View File

@ -3,7 +3,7 @@ USING: arrays math.private kernel math compiler inference
inference.dataflow optimizer tools.test kernel.private generic
sequences words inference.class quotations alien
alien.c-types strings sbufs sequences.private
slots.private combinators ;
slots.private combinators definitions ;
! Make sure these compile even though this is invalid code
[ ] [ [ 10 mod 3.0 /i ] dataflow optimize drop ] unit-test

View File

@ -265,8 +265,9 @@ M: staging-violation summary
"A parsing word cannot be used in the same file it is defined in." ;
: execute-parsing ( word -- )
dup
new-definitions get first key? [ staging-violation ] when
new-definitions get [
dupd first key? [ staging-violation ] when
] when*
execute ;
: parse-step ( accum end -- accum ? )
@ -300,6 +301,9 @@ SYMBOL: lexer-factory
: parse-lines ( lines -- quot )
lexer-factory get call (parse-lines) ;
: parse ( str -- quot )
[ string-lines parse-lines ] with-compilation-unit ;
! Parsing word utilities
: parse-effect ( -- effect )
")" parse-tokens { "--" } split1 dup [
@ -421,7 +425,9 @@ SYMBOL: bootstrap-syntax
file get source-file-path =
] assoc-subset ;
: removed-definitions ( -- definitions ) new-definitions get old-definitions get [ first2 union ] 2apply diff ;
: removed-definitions ( -- definitions )
new-definitions old-definitions
[ get first2 union ] 2apply diff ;
: smudged-usage ( -- usages referenced removed )
removed-definitions filter-moved keys [

View File

@ -256,7 +256,7 @@ M: builtin-class see-class*
: see-class ( class -- )
dup class? [
nl [ dup see-class* ] with-pprint nl
dup seeing-word dup see-class*
] when drop ;
: see-methods ( generic -- seq )
@ -265,7 +265,7 @@ M: builtin-class see-class*
M: word see
[
dup see-class*
dup see-class
dup class? over symbol? and not [ dup (see) ] when
] with-use nl
[

View File

@ -233,3 +233,9 @@ C: <erg's-reshape-problem> erg's-reshape-problem
[ t ] [ cons-test-1 array-capacity "a" get array-capacity = ] unit-test
[ t ] [ 1 cons-test-3 array-capacity "a" get array-capacity = ] unit-test
[ t ] [
[
"IN: temporary SYMBOL: not-a-class C: <not-a-class> not-a-class" eval
] catch [ check-tuple? ] is?
] unit-test

View File

@ -1,13 +1,11 @@
USING: math definitions help.topics help tools.test
prettyprint parser io.streams.string kernel source-files
assocs namespaces words io ;
assocs namespaces words io sequences ;
IN: temporary
[ ] [ \ + >link see ] unit-test
[
file-vocabs
[ 4 ] [
"IN: temporary USING: help.syntax ; : hello ; HELP: hello \"test\" ; ARTICLE: \"hello\" \"world\" ; ARTICLE: \"hello2\" \"world\" ;" <string-reader> "foo"
parse-stream drop
@ -34,9 +32,9 @@ IN: temporary
"hello" "temporary" lookup "help" word-prop
] unit-test
[ [ ] ] [ "IN: temporary USING: help.syntax ; : xxx ; HELP: xxx ;" parse ] unit-test
[ ] [ "IN: temporary USING: help.syntax ; : xxx ; HELP: xxx ;" eval ] unit-test
[ ] [ "xxx" "temporary" lookup help ] unit-test
[ ] [ "xxx" "temporary" lookup >link synopsis print ] unit-test
] with-scope
] with-file-vocabs

2
extra/help/definitions/definitions.factor Normal file → Executable file
View File

@ -16,8 +16,6 @@ M: link forget link-name remove-article ;
M: link definition article-content ;
M: link see (see) ;
M: link synopsis*
\ ARTICLE: pprint-word
dup link-name pprint*

4
extra/help/syntax/syntax-tests.factor Normal file → Executable file
View File

@ -2,8 +2,6 @@ IN: temporary
USING: tools.test parser vocabs help.syntax namespaces ;
[
file-vocabs
[ "foobar" ] [
"IN: temporary USE: help.syntax ABOUT: \"foobar\"" eval
"temporary" vocab vocab-help
@ -20,4 +18,4 @@ USING: tools.test parser vocabs help.syntax namespaces ;
"IN: temporary USE: help.syntax ABOUT: xyz" eval
"temporary" vocab vocab-help
] unit-test
] with-scope
] with-file-vocabs

2
extra/ui/gadgets/gadgets-docs.factor Normal file → Executable file
View File

@ -306,5 +306,3 @@ $nl
{ $subsection control-value }
{ $subsection set-control-value }
{ $see-also "models" } ;
ABOUT: "ui-control-impl"

View File

@ -129,7 +129,7 @@ M: interactor stream-read-partial
: try-parse ( str interactor -- quot/error/f )
[
[
[ restore-vars [ parse ] with-compilation-unit ] keep save-vars
[ restore-vars parse ] keep save-vars
] [
>r f swap set-interactor-busy? drop r>
dup delegate unexpected-eof? [ drop f ] when

View File

@ -34,7 +34,7 @@ f <workspace> dup [
workspace-listener
listener-gadget-input
"ok" on
parse-interactive
stream-read-quot
"c" get continue-with
] in-thread drop