fix unit tests

db4
Doug Coleman 2008-10-02 16:02:31 -05:00
parent 1c189a479c
commit 50493ba446
5 changed files with 12 additions and 10 deletions

View File

@ -3,4 +3,4 @@ IN: db.tests
{ 1 0 } [ [ drop ] query-each ] must-infer-as
{ 1 1 } [ [ ] query-map ] must-infer-as
{ 2 0 } [ [ ] with-db ] must-infer-as
{ 1 0 } [ [ ] with-db ] must-infer-as

View File

@ -13,7 +13,7 @@ USE: db.sqlite
[ "pool-test.db" temp-file delete-file ] ignore-errors
[ ] [ "pool-test.db" temp-file sqlite-db <db-pool> "pool" set ] unit-test
[ ] [ "pool-test.db" temp-file <sqlite-db> <db-pool> "pool" set ] unit-test
[ ] [ "pool" get expired>> t >>expired drop ] unit-test

View File

@ -1,13 +1,14 @@
! You will need to run 'createdb factor-test' to create the database.
! Set username and password in the 'connect' word.
USING: kernel db.postgresql alien continuations io classes
prettyprint sequences namespaces tools.test db
db.tuples db.types unicode.case ;
db.tuples db.types unicode.case accessors ;
IN: db.postgresql.tests
: test-db ( -- postgresql-db )
{ "localhost" "postgres" "foob" "factor-test" } postgresql-db ;
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
"factor-test" >>database ;
[ ] [ test-db [ ] with-db ] unit-test
@ -92,4 +93,4 @@ IN: db.postgresql.tests
: with-dummy-db ( quot -- )
>r T{ postgresql-db } db r> with-variable ;
[ T{ postgresql-db } db ] dip with-variable ;

View File

@ -4,7 +4,7 @@ continuations db.types db.tuples unicode.case ;
IN: db.sqlite.tests
: db-path "test.db" temp-file ;
: test.db db-path sqlite-db ;
: test.db db-path <sqlite-db> ;
[ ] [ [ db-path delete-file ] ignore-errors ] unit-test

View File

@ -7,7 +7,7 @@ destructors mirrors sets db.types ;
IN: db.tuples
<PRIVATE
! returns a sequence of prepared-statements
HOOK: create-sql-statement db ( class -- object )
HOOK: drop-sql-statement db ( class -- object )
@ -65,6 +65,7 @@ GENERIC: eval-generator ( singleton -- object )
: do-count ( exemplar-tuple statement -- tuples )
[ [ bind-tuple ] [ nip default-query ] 2bi ] with-disposal ;
PRIVATE>