-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathTestModelErrors.fs
53 lines (47 loc) · 1.39 KB
/
TestModelErrors.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module Rezoom.SQL.Test.TestModelErrors
open System
open NUnit.Framework
open FsUnit
open Rezoom.SQL.Compiler
open Rezoom.SQL.Mapping
[<Test>]
let ``duplicate create view complains`` () =
expectError (Error.objectAlreadyExists "main.VUsers")
"""
create view VUsers as
select * from Users;
create view VUsers as
select * from USers;
"""
[<Test>]
let ``duplicate create table complains`` () =
expectError (Error.objectAlreadyExists "main.Users")
"""
create view Users as
select * from Users;
"""
[<Test>]
let ``no such column to index`` () =
expectError (Error.noSuchColumn "Goober")
"""
create index IX_Users_Goober on Users(Id, Goober);
"""
[<Test>]
let ``no such column to index on creation`` () =
expectError (Error.noSuchColumn "Qux")
"""
create table MetaSyntactic
( Foo int
, Bar int
, Baz int
, unique (Foo, Bar, Qux)
);
"""
[<Test>]
let ``can't drop table referenced by others`` () =
expectError (Error.tableIsReferencedByFKs "main.Users" ["main.UserGroupMaps"])
"drop table Users"
[<Test>]
let ``non existing schema name`` () =
expectErrorWithModel (fun model -> Error.noSuchSchema model.Schemas "a")
"select * from a.b"