db.postgresql: configurable test db setting

adds a \ postgresql-db global (analoguous to the \ imap-settings one)
which holds settings to a postgres db so that the tests have something
to test against.
db4
Björn Lindqvist 2014-08-17 22:07:56 +02:00
parent be372831f5
commit e62acb7db3
2 changed files with 6 additions and 14 deletions

View File

@ -1,6 +1,6 @@
USING: kernel db.postgresql alien continuations io classes
prettyprint sequences math namespaces tools.test db db.private
db.tuples db.types unicode.case accessors system db.tester ;
USING: accessors alien continuations db db.queries db.postgresql db.private
db.tester db.tuples db.types io classes kernel math namespaces prettyprint
sequences system tools.test unicode.case ;
IN: db.postgresql.tests
: nonexistant-db ( -- db )
@ -15,7 +15,7 @@ IN: db.postgresql.tests
2000 [ [ nonexistant-db [ ] with-db ] ignore-errors ] times
] unit-test
! Ensure the table exists
! Ensure the test database exists
[ ] [ postgresql-test-db [ ] with-db ] unit-test
[ ] [

View File

@ -11,18 +11,10 @@ IN: db.tester
H{ { CHAR: - CHAR: _ } { CHAR: . CHAR: _ } } substitute ;
: postgresql-test-db ( -- postgresql-db )
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
postgresql-test-db-name >>database ;
\ postgresql-db get-global postgresql-test-db-name >>database ;
: postgresql-template1-db ( -- postgresql-db )
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
"template1" >>database ;
\ postgresql-db get-global ;
: sqlite-test-db ( -- sqlite-db )
cpu name>> "tuples-test." ".db" surround