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
parent
be372831f5
commit
e62acb7db3
|
@ -1,6 +1,6 @@
|
||||||
USING: kernel db.postgresql alien continuations io classes
|
USING: accessors alien continuations db db.queries db.postgresql db.private
|
||||||
prettyprint sequences math namespaces tools.test db db.private
|
db.tester db.tuples db.types io classes kernel math namespaces prettyprint
|
||||||
db.tuples db.types unicode.case accessors system db.tester ;
|
sequences system tools.test unicode.case ;
|
||||||
IN: db.postgresql.tests
|
IN: db.postgresql.tests
|
||||||
|
|
||||||
: nonexistant-db ( -- db )
|
: nonexistant-db ( -- db )
|
||||||
|
@ -15,7 +15,7 @@ IN: db.postgresql.tests
|
||||||
2000 [ [ nonexistant-db [ ] with-db ] ignore-errors ] times
|
2000 [ [ nonexistant-db [ ] with-db ] ignore-errors ] times
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Ensure the table exists
|
! Ensure the test database exists
|
||||||
[ ] [ postgresql-test-db [ ] with-db ] unit-test
|
[ ] [ postgresql-test-db [ ] with-db ] unit-test
|
||||||
|
|
||||||
[ ] [
|
[ ] [
|
||||||
|
|
|
@ -11,18 +11,10 @@ IN: db.tester
|
||||||
H{ { CHAR: - CHAR: _ } { CHAR: . CHAR: _ } } substitute ;
|
H{ { CHAR: - CHAR: _ } { CHAR: . CHAR: _ } } substitute ;
|
||||||
|
|
||||||
: postgresql-test-db ( -- postgresql-db )
|
: postgresql-test-db ( -- postgresql-db )
|
||||||
<postgresql-db>
|
\ postgresql-db get-global postgresql-test-db-name >>database ;
|
||||||
"localhost" >>host
|
|
||||||
"postgres" >>username
|
|
||||||
"thepasswordistrust" >>password
|
|
||||||
postgresql-test-db-name >>database ;
|
|
||||||
|
|
||||||
: postgresql-template1-db ( -- postgresql-db )
|
: postgresql-template1-db ( -- postgresql-db )
|
||||||
<postgresql-db>
|
\ postgresql-db get-global ;
|
||||||
"localhost" >>host
|
|
||||||
"postgres" >>username
|
|
||||||
"thepasswordistrust" >>password
|
|
||||||
"template1" >>database ;
|
|
||||||
|
|
||||||
: sqlite-test-db ( -- sqlite-db )
|
: sqlite-test-db ( -- sqlite-db )
|
||||||
cpu name>> "tuples-test." ".db" surround
|
cpu name>> "tuples-test." ".db" surround
|
||||||
|
|
Loading…
Reference in New Issue