]> gitweb.factorcode.org Git - factor.git/blob - basis/db/errors/postgresql/postgresql-tests.factor
f6668031e51114b29db2e8dbf4ad7302d7ced0b8
[factor.git] / basis / db / errors / postgresql / postgresql-tests.factor
1 ! Copyright (C) 2009 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors combinators.short-circuit db db.errors
4 db.errors.postgresql db.postgresql io.files.unique kernel namespaces
5 tools.test db.tester continuations ;
6 IN: db.errors.postgresql.tests
7
8 [
9
10     [ "drop table foo;" sql-command ] ignore-errors
11     [ "drop table ship;" sql-command ] ignore-errors
12
13     [
14         "insert into foo (id) values('1');" sql-command
15     ] [
16         { [ sql-table-missing? ] [ table>> "foo" = ] } 1&&
17     ] must-fail-with
18
19     [
20         "create table ship(id integer);" sql-command
21         "create table ship(id integer);" sql-command
22     ] [
23         { [ sql-table-exists? ] [ table>> "ship" = ] } 1&&
24     ] must-fail-with
25     
26     [
27         "create table foo(id) lol;" sql-command
28     ] [
29         sql-syntax-error?
30     ] must-fail-with
31
32 ] test-postgresql