Skip to content

Commit

Permalink
Tweak tests
Browse files Browse the repository at this point in the history
Signed-off-by: Morgan Douglas <[email protected]>
  • Loading branch information
morgando committed Jan 13, 2025
1 parent 1e0006c commit 611ee1b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/constraints.test/t20.req
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ drop table if exists foo
create table foo(i int)$$
create table bar(i int)$$
begin
alter table foo {schema{int i} keys{dup "key" = i} constraints{"key" -> <"bar" : "pk">}} $$
alter table foo {schema{int i} keys{dup "key" = i} constraints{"key" -> "bar":"pk" on delete cascade }} $$
alter table bar {schema{int i} keys{"pk" = i}} $$
commit
insert into foo values(1)
Expand Down
16 changes: 15 additions & 1 deletion tests/constraints.test/t20.req.exp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
[create table foo(i int)] rc 0
[create table bar(i int)] rc 0
[begin] rc 0
[alter table foo {schema{int i} keys{dup "key" = i} constraints{"key" -> <"bar" : "pk">}}] rc 0
[alter table foo {schema{int i} keys{dup "key" = i} constraints{"key" -> "bar":"pk" on delete cascade }}] rc 0
[alter table bar {schema{int i} keys{"pk" = i}}] rc 0
[commit] rc 0
[insert into foo values(1)] failed with rc 3 Transaction violates foreign key constraint foo(i) -> bar(i): key value does not exist in parent table
[select 'shouldnt see me' from foo] rc 0
(rows inserted=1)
[insert into bar values(1)] rc 0
(rows inserted=1)
[insert into foo values(1)] rc 0
('should see me'='should see me')
[select 'should see me' from foo] rc 0
('should see me'='should see me')
[select 'should see me' from bar] rc 0
(rows deleted=1)
[delete from bar where 1] rc 0
[select 'shouldnt see me' from foo] rc 0
[select 'shouldnt see me' from bar] rc 0
16 changes: 0 additions & 16 deletions tests/constraints.test/t24.req

This file was deleted.

0 comments on commit 611ee1b

Please sign in to comment.