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
tools.test vectors words quotations classes io.streams.string
classes.private classes.union classes.mixin classes.predicate
vectors definitions source-files ;
vectors definitions source-files compiler.units ;
IN: temporary
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"

View File

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

View File

@ -1,6 +1,6 @@
USING: compiler definitions generic assocs inference math
namespaces parser tools.test words kernel sequences arrays io
effects tools.test.inference words.private ;
effects tools.test.inference compiler.units ;
IN: temporary
DEFER: x-1
@ -173,3 +173,15 @@ DEFER: hints-test-2
[ ] [ "IN: temporary USE: math : hints-test-1 5 + ;" eval ] 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
USING: compiler generator generator.registers
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> ;

View File

@ -2,7 +2,8 @@
USING: arrays compiler kernel kernel.private math
hashtables.private math.private namespaces sequences
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
! Oops!

View File

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

View File

@ -1,7 +1,8 @@
USING: alien arrays definitions generic generic.standard
generic.math assocs hashtables io kernel math namespaces parser
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
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
sequences words inference.class quotations alien
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
[ ] [ [ 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
FORGET: xyz
GENERIC: xyz ( n -- n )
M: integer xyz ;

View File

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

View File

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

View File

@ -79,7 +79,8 @@ HELP: reset-checksums
HELP: forget-source
{ $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
{ $values { "file" source-file } }

View File

@ -73,15 +73,14 @@ uses definitions ;
M: pathname where pathname-string 1 2array ;
M: pathname forget*
pathname-string
: forget-source ( path -- )
dup source-file
dup unxref-source
source-file-definitions [ keys forget-all ] each
source-files get delete-at ;
: forget-source ( path -- )
[ <pathname> forget ] with-compilation-unit ;
M: pathname forget*
pathname-string forget-source ;
: rollback-source-file ( source-file -- )
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
namespaces quotations sequences.private classes continuations
generic.standard effects tuples tuples.private arrays vectors
strings ;
strings compiler.units ;
IN: temporary
[ t ] [ \ tuple-class \ class class< ] unit-test

View File

@ -3,7 +3,7 @@ IN: temporary
USING: vocabs.loader tools.test continuations vocabs math
kernel arrays sequences namespaces io.streams.string
parser source-files words assocs tuples definitions
debugger ;
debugger compiler.units ;
! This vocab should not exist, but just in case...
[ ] [
@ -50,9 +50,11 @@ IN: temporary
3array
] 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
@ -89,7 +91,10 @@ IN: temporary
] 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
[ "vocabs.loader.test.b" require ] unit-test-fails
@ -109,7 +114,10 @@ IN: temporary
[ 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
[ ] [ "vocabs.loader.test.b" refresh ] unit-test

View File

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

View File

@ -1,7 +1,7 @@
IN: temporary
USING: help.crossref help.topics help.markup tools.test words
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

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.
USING: namespaces arrays prettyprint sequences kernel
vectors quotations words parser assocs combinators
continuations debugger io io.files vocabs tools.time
vocabs.loader source-files ;
vocabs.loader source-files compiler.units ;
IN: tools.test
SYMBOL: failures
@ -35,14 +35,15 @@ TUPLE: expected-error ;
[ t ] swap unit-test ;
: run-test ( path -- failures )
"temporary" forget-vocab
[ "temporary" forget-vocab ] with-compilation-unit
[
V{ } clone [
failures [
[ run-file ] [ swap failure ] recover
] with-variable
] keep
] keep forget-source ;
] keep
[ forget-source ] with-compilation-unit ;
: failure. ( triple -- )
dup second .

View File

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