db.postgresql: ensure that 2 line error messages are handled
parent
97b3ee37ff
commit
655797ff34
|
@ -1,6 +1,6 @@
|
||||||
USING: accessors alien continuations db db.queries db.postgresql db.private
|
USING: accessors alien continuations db db.errors db.queries db.postgresql
|
||||||
db.tester db.tuples db.types io classes kernel math namespaces prettyprint
|
db.private db.tester db.tuples db.types io classes kernel math namespaces
|
||||||
sequences system tools.test unicode.case ;
|
prettyprint sequences system tools.test unicode.case ;
|
||||||
IN: db.postgresql.tests
|
IN: db.postgresql.tests
|
||||||
|
|
||||||
: nonexistant-db ( -- db )
|
: nonexistant-db ( -- db )
|
||||||
|
@ -16,7 +16,19 @@ IN: db.postgresql.tests
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
! Ensure the test database exists
|
! Ensure the test database exists
|
||||||
[ ] [ postgresql-test-db [ ] with-db ] unit-test
|
postgresql-template1-db [
|
||||||
|
postgresql-test-db-name ensure-database
|
||||||
|
] with-db
|
||||||
|
|
||||||
|
! Triggers a two line error message (ERROR + DETAIL) because two
|
||||||
|
! connections can't simultaneously use the template1 database.
|
||||||
|
[
|
||||||
|
postgresql-template1-db [
|
||||||
|
postgresql-template1-db [
|
||||||
|
"will_never_exist" ensure-database
|
||||||
|
] with-db
|
||||||
|
] with-db
|
||||||
|
] [ sql-unknown-error? ] must-fail-with
|
||||||
|
|
||||||
[ ] [
|
[ ] [
|
||||||
postgresql-test-db [
|
postgresql-test-db [
|
||||||
|
|
|
@ -284,10 +284,10 @@ M: postgresql-db-connection compound ( string object -- string' )
|
||||||
M: postgresql-db-connection parse-db-error
|
M: postgresql-db-connection parse-db-error
|
||||||
"\n" split dup length {
|
"\n" split dup length {
|
||||||
{ 1 [ first parse-postgresql-sql-error ] }
|
{ 1 [ first parse-postgresql-sql-error ] }
|
||||||
|
{ 2 [ concat parse-postgresql-sql-error ] }
|
||||||
{ 3 [
|
{ 3 [
|
||||||
first3
|
first3
|
||||||
[ parse-postgresql-sql-error ] 2dip
|
[ parse-postgresql-sql-error ] 2dip
|
||||||
postgresql-location >>location
|
postgresql-location >>location
|
||||||
] }
|
] }
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue