From e62acb7db30918597ee21da74d2c16378654b31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Sun, 17 Aug 2014 22:07:56 +0200 Subject: [PATCH] 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. --- basis/db/postgresql/postgresql-tests.factor | 8 ++++---- basis/db/tester/tester.factor | 12 ++---------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/basis/db/postgresql/postgresql-tests.factor b/basis/db/postgresql/postgresql-tests.factor index ddfae56f87..04348f44cb 100644 --- a/basis/db/postgresql/postgresql-tests.factor +++ b/basis/db/postgresql/postgresql-tests.factor @@ -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 [ ] [ diff --git a/basis/db/tester/tester.factor b/basis/db/tester/tester.factor index 4471ae4979..e778168cff 100644 --- a/basis/db/tester/tester.factor +++ b/basis/db/tester/tester.factor @@ -11,18 +11,10 @@ IN: db.tester H{ { CHAR: - CHAR: _ } { CHAR: . CHAR: _ } } substitute ; : postgresql-test-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 ) - - "localhost" >>host - "postgres" >>username - "thepasswordistrust" >>password - "template1" >>database ; + \ postgresql-db get-global ; : sqlite-test-db ( -- sqlite-db ) cpu name>> "tuples-test." ".db" surround