Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(parser): simplify parser test #16942

Merged
merged 5 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ members = [
"src/risedevtool/config",
"src/rpc_client",
"src/sqlparser",
"src/sqlparser/test_runner",
"src/storage",
"src/storage/backup",
"src/storage/compactor",
Expand Down
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extend = [
{ path = "src/risedevtool/redis.toml" },
{ path = "src/risedevtool/connector.toml" },
{ path = "src/risedevtool/risedev-components.toml" },
{ path = "src/sqlparser/test_runner/sqlparser_test.toml" },
{ path = "src/sqlparser/sqlparser_test.toml" },
{ path = "src/frontend/planner_test/planner_test.toml" },
{ path = "src/tests/compaction_test/Makefile.toml" },
{ path = "src/storage/backup/integration_tests/Makefile.toml" },
Expand Down
11 changes: 11 additions & 0 deletions src/sqlparser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ winnow = { version = "0.6.8", git = "https://github.com/TennyZhuang/winnow.git",
workspace-hack = { path = "../workspace-hack" }

[dev-dependencies]
anyhow = "1"
console = "0.15"
libtest-mimic = "0.7"
matches = "0.1"
serde = { version = "1", features = ["derive"] }
serde_with = "3"
serde_yaml = "0.9"
walkdir = "2"

[package.metadata.release]
# Instruct `cargo release` to not run `cargo publish` locally:
Expand All @@ -46,5 +53,9 @@ disable-publish = true
name = "sqlparser"
path = "src/bin/sqlparser.rs"

[[test]]
name = "parser_test"
harness = false

[lints]
workspace = true
2 changes: 1 addition & 1 deletion src/sqlparser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ This parser is a fork of <https://github.com/andygrove/sqlparser-rs>.

## Add a new test case
1. Copy an item in the yaml file and edit the `input` to the sql you want to test.
2. Run `./risedev do-apply-parser-test` to regenerate the `formatted_sql` which is the expected output.
2. Run `./risedev update-parser-test` to regenerate the `formatted_sql` which is the expected output.
8 changes: 8 additions & 0 deletions src/sqlparser/sqlparser_test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[tasks.update-parser-test]
description = "Update parser test data"
private = true
script = '''
#!/usr/bin/env bash
set -e
UPDATE_PARSER_TEST=1 cargo test --test parser_test
'''
42 changes: 0 additions & 42 deletions src/sqlparser/test_runner/Cargo.toml

This file was deleted.

56 changes: 0 additions & 56 deletions src/sqlparser/test_runner/sqlparser_test.toml

This file was deleted.

125 changes: 0 additions & 125 deletions src/sqlparser/test_runner/src/bin/apply.rs

This file was deleted.

Loading
Loading