Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cor committed Oct 18, 2023
1 parent b57ea13 commit a7b2966
Show file tree
Hide file tree
Showing 3 changed files with 5,557 additions and 5,537 deletions.
36 changes: 30 additions & 6 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,36 @@ var (
output: "select * from t1 where col in (select 1 union select 2)",
}, {
input: "select * from t1 where exists (select a from t2 union select b from t3)",
}, {
},
{
input: "select /* distinct */ distinct 1 from t",
}, {
},
{
input: "select all col from t",
output: "select all col from t",
}, {
},
{
input: "select /* straight_join */ straight_join 1 from t",
}, {
},
{
input:"select sql_calc_found_rows distinct * from t",
},
{
input:"select distinct sql_calc_found_rows * from t",
},
{
input:"select distinct sql_calc_found_rows distinct * from t",
},
{
input:"select sql_no_cache sql_cache all distinct sql_calc_found_rows straight_join * from t",
},
{
input:"select straight_join sql_calc_found_rows distinct all sql_cache sql_no_cache * from t",
},
{
input:"select sql_no_cache sql_cache all distinct sql_calc_found_rows straight_join straight_join sql_calc_found_rows distinct all sql_cache sql_no_cache * from t",
},
{
input: "select /* for update */ 1 from t for update",
}, {
input: "select /* skip locked */ 1 from t for update skip locked",
Expand Down Expand Up @@ -3355,8 +3377,7 @@ var (
{
input: "alter table t insert_method=last",
output: "alter table t",
}, {},

},
}

// Any tests that contain multiple statements within the body (such as BEGIN/END blocks) should go here.
Expand Down Expand Up @@ -4754,6 +4775,9 @@ func runParseTestCaseWithParserOptions(t *testing.T, tcase parseTest, options Pa
tcase.output = tcase.input
}
tree, err := ParseWithOptions(tcase.input, options)
if err != nil {
panic(tcase.input)
}
require.NoError(t, err)

assertTestcaseOutput(t, tcase, tree)
Expand Down
Loading

0 comments on commit a7b2966

Please sign in to comment.