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
|
||||
db.tester db.tuples db.types io classes kernel math namespaces prettyprint
|
||||
sequences system tools.test unicode.case ;
|
||||
USING: accessors alien continuations db db.errors 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 )
|
||||
|
@ -16,7 +16,19 @@ IN: db.postgresql.tests
|
|||
] unit-test
|
||||
|
||||
! 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 [
|
||||
|
|
|
@ -284,10 +284,10 @@ M: postgresql-db-connection compound ( string object -- string' )
|
|||
M: postgresql-db-connection parse-db-error
|
||||
"\n" split dup length {
|
||||
{ 1 [ first parse-postgresql-sql-error ] }
|
||||
{ 2 [ concat parse-postgresql-sql-error ] }
|
||||
{ 3 [
|
||||
first3
|
||||
[ parse-postgresql-sql-error ] 2dip
|
||||
postgresql-location >>location
|
||||
] }
|
||||
} case ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue