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