Fix unit tests

db4
Slava Pestov 2008-01-09 19:13:26 -05:00
parent 6df84617d6
commit 542b85889d
19 changed files with 53 additions and 31 deletions

View File

@ -2,7 +2,7 @@ USING: alien arrays definitions generic assocs hashtables io
kernel math namespaces parser prettyprint sequences strings kernel math namespaces parser prettyprint sequences strings
tools.test vectors words quotations classes io.streams.string tools.test vectors words quotations classes io.streams.string
classes.private classes.union classes.mixin classes.predicate classes.private classes.union classes.mixin classes.predicate
vectors definitions source-files ; vectors definitions source-files compiler.units ;
IN: temporary IN: temporary
H{ } "s" set H{ } "s" set

View File

@ -1,4 +1,5 @@
USING: io.files tools.test sequences namespaces kernel ; USING: io.files tools.test sequences namespaces kernel
compiler.units ;
{ {
"templates-early" "templates-early"

View File

@ -47,7 +47,6 @@ IN: temporary
sort-classes min-class sort-classes min-class
] unit-test ] unit-test
FORGET: xyz
GENERIC: xyz ( obj -- obj ) GENERIC: xyz ( obj -- obj )
M: array xyz xyz ; M: array xyz xyz ;

View File

@ -1,6 +1,6 @@
USING: compiler definitions generic assocs inference math USING: compiler definitions generic assocs inference math
namespaces parser tools.test words kernel sequences arrays io namespaces parser tools.test words kernel sequences arrays io
effects tools.test.inference words.private ; effects tools.test.inference compiler.units ;
IN: temporary IN: temporary
DEFER: x-1 DEFER: x-1
@ -173,3 +173,15 @@ DEFER: hints-test-2
[ ] [ "IN: temporary USE: math : hints-test-1 5 + ;" eval ] unit-test [ ] [ "IN: temporary USE: math : hints-test-1 5 + ;" eval ] unit-test
[ 10 ] [ hints-test-2 ] unit-test [ 10 ] [ hints-test-2 ] unit-test
DEFER: inline-then-not-inline-test-2
[ ] [ "IN: temporary : inline-then-not-inline-test-1 1 2 3 ; inline" eval ] unit-test
[ ] [ "IN: temporary : inline-then-not-inline-test-2 inline-then-not-inline-test-1 ;" eval ] unit-test
[ 1 2 3 ] [ inline-then-not-inline-test-2 ] unit-test
[ ] [ "IN: temporary : inline-then-not-inline-test-1 6 9 ;" eval ] unit-test
[ 6 9 ] [ inline-then-not-inline-test-2 ] unit-test

View File

@ -2,7 +2,7 @@
IN: temporary IN: temporary
USING: compiler generator generator.registers USING: compiler generator generator.registers
generator.registers.private tools.test namespaces sequences generator.registers.private tools.test namespaces sequences
words kernel math effects definitions ; words kernel math effects definitions compiler.units ;
: <int-vreg> ( n -- vreg ) T{ int-regs } <vreg> ; : <int-vreg> ( n -- vreg ) T{ int-regs } <vreg> ;

View File

@ -2,7 +2,8 @@
USING: arrays compiler kernel kernel.private math USING: arrays compiler kernel kernel.private math
hashtables.private math.private namespaces sequences hashtables.private math.private namespaces sequences
sequences.private tools.test namespaces.private slots.private sequences.private tools.test namespaces.private slots.private
combinators.private byte-arrays alien layouts words definitions ; combinators.private byte-arrays alien layouts words definitions
compiler.units ;
IN: temporary IN: temporary
! Oops! ! Oops!

View File

@ -1,5 +1,6 @@
IN: temporary IN: temporary
USING: tools.test generic kernel definitions sequences ; USING: tools.test generic kernel definitions sequences
compiler.units ;
TUPLE: combination-1 ; TUPLE: combination-1 ;

View File

@ -1,7 +1,8 @@
USING: alien arrays definitions generic generic.standard USING: alien arrays definitions generic generic.standard
generic.math assocs hashtables io kernel math namespaces parser generic.math assocs hashtables io kernel math namespaces parser
prettyprint sequences strings tools.test vectors words prettyprint sequences strings tools.test vectors words
quotations classes continuations layouts classes.union sorting ; quotations classes continuations layouts classes.union sorting
compiler.units ;
IN: temporary IN: temporary
GENERIC: foobar ( x -- y ) GENERIC: foobar ( x -- y )

View File

@ -3,7 +3,7 @@ USING: arrays math.private kernel math compiler inference
inference.dataflow optimizer tools.test kernel.private generic inference.dataflow optimizer tools.test kernel.private generic
sequences words inference.class quotations alien sequences words inference.class quotations alien
alien.c-types strings sbufs sequences.private alien.c-types strings sbufs sequences.private
slots.private combinators definitions ; slots.private combinators definitions compiler.units ;
! Make sure these compile even though this is invalid code ! Make sure these compile even though this is invalid code
[ ] [ [ 10 mod 3.0 /i ] dataflow optimize drop ] unit-test [ ] [ [ 10 mod 3.0 /i ] dataflow optimize drop ] unit-test
@ -34,8 +34,6 @@ M: f detect-f ;
[ ] [ [ fixnum< [ ] [ ] if ] dataflow optimize drop ] unit-test [ ] [ [ fixnum< [ ] [ ] if ] dataflow optimize drop ] unit-test
FORGET: xyz
GENERIC: xyz ( n -- n ) GENERIC: xyz ( n -- n )
M: integer xyz ; M: integer xyz ;

View File

@ -1,7 +1,7 @@
USING: arrays math parser tools.test kernel generic words USING: arrays math parser tools.test kernel generic words
io.streams.string namespaces classes effects source-files io.streams.string namespaces classes effects source-files
assocs sequences strings io.files definitions continuations assocs sequences strings io.files definitions continuations
sorting tuples ; sorting tuples compiler.units ;
IN: temporary IN: temporary
[ [

View File

@ -2,7 +2,7 @@ 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 ; continuations generic compiler.units ;
IN: temporary IN: temporary
[ "4" ] [ 4 unparse ] unit-test [ "4" ] [ 4 unparse ] unit-test

View File

@ -79,7 +79,8 @@ HELP: reset-checksums
HELP: forget-source HELP: forget-source
{ $values { "path" "a pathname string" } } { $values { "path" "a pathname string" } }
{ $description "Forgets all information known about a source file." } ; { $description "Forgets all information known about a source file." }
{ $notes "This word must be called from inside " { $link with-compilation-unit } "." } ;
HELP: record-definitions HELP: record-definitions
{ $values { "file" source-file } } { $values { "file" source-file } }

View File

@ -73,15 +73,14 @@ uses definitions ;
M: pathname where pathname-string 1 2array ; M: pathname where pathname-string 1 2array ;
M: pathname forget* : forget-source ( path -- )
pathname-string
dup source-file dup source-file
dup unxref-source dup unxref-source
source-file-definitions [ keys forget-all ] each source-file-definitions [ keys forget-all ] each
source-files get delete-at ; source-files get delete-at ;
: forget-source ( path -- ) M: pathname forget*
[ <pathname> forget ] with-compilation-unit ; pathname-string forget-source ;
: rollback-source-file ( source-file -- ) : rollback-source-file ( source-file -- )
dup source-file-definitions new-definitions get [ union ] 2map dup source-file-definitions new-definitions get [ union ] 2map

View File

@ -2,7 +2,7 @@ USING: definitions generic kernel kernel.private math
math.constants parser sequences tools.test words assocs math.constants parser sequences tools.test words assocs
namespaces quotations sequences.private classes continuations namespaces quotations sequences.private classes continuations
generic.standard effects tuples tuples.private arrays vectors generic.standard effects tuples tuples.private arrays vectors
strings ; strings compiler.units ;
IN: temporary IN: temporary
[ t ] [ \ tuple-class \ class class< ] unit-test [ t ] [ \ tuple-class \ class class< ] unit-test

View File

@ -3,7 +3,7 @@ IN: temporary
USING: vocabs.loader tools.test continuations vocabs math USING: vocabs.loader tools.test continuations vocabs math
kernel arrays sequences namespaces io.streams.string kernel arrays sequences namespaces io.streams.string
parser source-files words assocs tuples definitions parser source-files words assocs tuples definitions
debugger ; debugger compiler.units ;
! This vocab should not exist, but just in case... ! This vocab should not exist, but just in case...
[ ] [ [ ] [
@ -50,9 +50,11 @@ IN: temporary
3array 3array
] unit-test ] unit-test
"resource:core/vocabs/loader/test/a/a.factor" forget-source
[ "vocabs.loader.test.a" forget-vocab ] with-compilation-unit [
"resource:core/vocabs/loader/test/a/a.factor" forget-source
"vocabs.loader.test.a" forget-vocab
] with-compilation-unit
0 "count-me" set-global 0 "count-me" set-global
@ -89,7 +91,10 @@ IN: temporary
] unit-test ] unit-test
[ ] [ [ ] [
"vocabs.loader.test.b" vocab-files [ forget-source ] each [
"vocabs.loader.test.b" vocab-files
[ forget-source ] each
] with-compilation-unit
] unit-test ] unit-test
[ "vocabs.loader.test.b" require ] unit-test-fails [ "vocabs.loader.test.b" require ] unit-test-fails
@ -109,7 +114,10 @@ IN: temporary
[ f ] [ "fred" "vocabs.loader.test.b" lookup undefined? ] unit-test [ f ] [ "fred" "vocabs.loader.test.b" lookup undefined? ] unit-test
[ ] [ [ ] [
"vocabs.loader.test.b" vocab-files [ forget-source ] each [
"vocabs.loader.test.b" vocab-files
[ forget-source ] each
] with-compilation-unit
] unit-test ] unit-test
[ ] [ "vocabs.loader.test.b" refresh ] unit-test [ ] [ "vocabs.loader.test.b" refresh ] unit-test

View File

@ -1,6 +1,6 @@
USING: arrays generic assocs kernel math namespaces USING: arrays generic assocs kernel math namespaces
sequences tools.test words definitions parser quotations sequences tools.test words definitions parser quotations
vocabs continuations tuples ; vocabs continuations tuples compiler.units ;
IN: temporary IN: temporary
[ 4 ] [ [ 4 ] [

View File

@ -1,7 +1,7 @@
IN: temporary IN: temporary
USING: help.crossref help.topics help.markup tools.test words USING: help.crossref help.topics help.markup tools.test words
definitions assocs sequences kernel namespaces parser arrays definitions assocs sequences kernel namespaces parser arrays
io.streams.string continuations debugger ; io.streams.string continuations debugger compiler.units ;
[ ] [ [ ] [
"IN: temporary USING: help.syntax help.markup ; : foo ; HELP: foo \"foo is great\" ; ARTICLE: \"foo\" \"Foo\" { $subsection foo } ;" eval "IN: temporary USING: help.syntax help.markup ; : foo ; HELP: foo \"foo is great\" ; ARTICLE: \"foo\" \"Foo\" { $subsection foo } ;" eval

View File

@ -1,9 +1,9 @@
! Copyright (C) 2003, 2007 Slava Pestov. ! Copyright (C) 2003, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: namespaces arrays prettyprint sequences kernel USING: namespaces arrays prettyprint sequences kernel
vectors quotations words parser assocs combinators vectors quotations words parser assocs combinators
continuations debugger io io.files vocabs tools.time continuations debugger io io.files vocabs tools.time
vocabs.loader source-files ; vocabs.loader source-files compiler.units ;
IN: tools.test IN: tools.test
SYMBOL: failures SYMBOL: failures
@ -35,14 +35,15 @@ TUPLE: expected-error ;
[ t ] swap unit-test ; [ t ] swap unit-test ;
: run-test ( path -- failures ) : run-test ( path -- failures )
"temporary" forget-vocab [ "temporary" forget-vocab ] with-compilation-unit
[ [
V{ } clone [ V{ } clone [
failures [ failures [
[ run-file ] [ swap failure ] recover [ run-file ] [ swap failure ] recover
] with-variable ] with-variable
] keep ] keep
] keep forget-source ; ] keep
[ forget-source ] with-compilation-unit ;
: failure. ( triple -- ) : failure. ( triple -- )
dup second . dup second .

View File

@ -1,7 +1,7 @@
IN: temporary IN: temporary
USING: ui.gadgets ui.gadgets.labels namespaces sequences kernel USING: ui.gadgets ui.gadgets.labels namespaces sequences kernel
math arrays tools.test io ui.gadgets.panes ui.traverse math arrays tools.test io ui.gadgets.panes ui.traverse
definitions ; definitions compiler.units ;
M: array gadget-children ; M: array gadget-children ;