Skip to content

Commit

Permalink
More tests, found another bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zachmu committed Jan 28, 2025
1 parent 078b10c commit 561baf3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions testing/go/alter_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ func TestAlterTable(t *testing.T) {
uid uuid default gen_random_uuid() NOT NULL
);`,
"INSERT INTO t1 (id) VALUES (1);",
"INSERT INTO t1 (id) VALUES (2);",
},
Assertions: []ScriptTestAssertion{
{
Expand All @@ -474,6 +475,15 @@ func TestAlterTable(t *testing.T) {
Query: "select uid is not null from t1 where id = 1;",
Expected: []sql.Row{{"t"}},
},
{
Query: "select uid is not null from t1 where id = 2;",
Expected: []sql.Row{{"t"}},
},
{
Query: "select (select uid from t1 where id = 2) = (select uid from t1 where id = 1);",
Skip: true, // panic in equality function
Expected: []sql.Row{{"f"}},
},
},
},
})
Expand Down
28 changes: 28 additions & 0 deletions testing/go/subqueries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,34 @@ func TestSubqueries(t *testing.T) {
},
},
},
{
Name: "subquery equality",
SetUpScript: []string{
`CREATE TABLE test (id INT, c varchar);`,
`INSERT INTO test VALUES (1, 'a'), (2, 'b'), (3, 'b');`,
},
Assertions: []ScriptTestAssertion{
{
Query: `SELECT * FROM test WHERE id = (SELECT id from test where id = 2);`,
Expected: []sql.Row{{int32(2), "b"}},
},
{
Skip: true, // panic in equality func
Query: `SELECT (SELECT id from test where id = 2) = (SELECT id from test where id = 2);`,
Expected: []sql.Row{{"t"}},
},
{
Skip: true, // panic in equality func
Query: `SELECT (SELECT c from test where id = 2) = (SELECT c from test where id = 3);`,
Expected: []sql.Row{{"t"}},
},
{
Skip: true, // panic in equality func
Query: `SELECT (SELECT c from test where id = 1) = (SELECT c from test where id = 2);`,
Expected: []sql.Row{{"f"}},
},
},
},
})
}

Expand Down

0 comments on commit 561baf3

Please sign in to comment.