]> gitweb.factorcode.org Git - factor.git/blob - basis/db/sqlite/errors/errors-tests.factor
ab30633e39aaed8f56c9c84fd3ccb4c92cb4f71a
[factor.git] / basis / db / sqlite / errors / errors-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.sqlite kernel locals tools.test ;
5
6 [| path |
7
8     path <sqlite-db> [
9
10         [
11             "insert into foo (id) values('1');" sql-command
12         ] [
13             { [ sql-table-missing? ] [ table>> "foo" = ] } 1&&
14         ] must-fail-with
15
16         "create table foo(id);" sql-command
17
18         [
19             "create table foo(id);" sql-command
20         ] [
21             { [ sql-table-exists? ] [ table>> "foo" = ] } 1&&
22         ] must-fail-with
23
24         "create index main_index on foo(id);" sql-command
25
26         [
27             "create index main_index on foo(id);" sql-command
28         ] [
29             { [ sql-index-exists? ] [ name>> "main_index" = ] } 1&&
30         ] must-fail-with
31
32     ] with-db
33 ] with-test-file