Skip to content

Commit

Permalink
feat: match multiline error (#200)
Browse files Browse the repository at this point in the history
* multiline line error

Signed-off-by: Bugen Zhao <[email protected]>

* fix unparse

Signed-off-by: Bugen Zhao <[email protected]>

* add tests

Signed-off-by: Bugen Zhao <[email protected]>

* add docs

Signed-off-by: Bugen Zhao <[email protected]>

* bump version and add changelog

Signed-off-by: Bugen Zhao <[email protected]>

* add empty variant to make it more clear

Signed-off-by: Bugen Zhao <[email protected]>

* refine display impl

Signed-off-by: Bugen Zhao <[email protected]>

---------

Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao authored Nov 9, 2023
1 parent 52d5122 commit 7ee44cd
Show file tree
Hide file tree
Showing 9 changed files with 338 additions and 76 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [0.18.0] - 2023-11-08

* Support matching multiline error message under `----` for both `statement error` and `query error`.
```
query error
SELECT 1/0;
----
db error: ERROR: Failed to execute query
Caused by these errors:
1: Failed to evaluate expression: 1/0
2: Division by zero
```

The output error message must be the exact match of the expected one to pass the test, except for the leading and trailing whitespaces. Users may use `--override` to let the runner update the test files with the actual output.

Empty lines are allowed in the expected error message. As a result, the message must end with two consecutive empty lines.

Breaking changes in the parser:
- Add new variants to `ParseErrorKind`. Mark it as `#[non_exhaustive]`.
- Change the type of `expected_error` from `Regex` to `ExpectedError`, which is either a inline `Regex` or multiline `String`.

## [0.17.2] - 2023-11-01

* fix(runner): fix parallel testing db name duplication. Now we use full file path instead of filename as the temporary db name in `run_parallel_async`.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "2"
members = ["sqllogictest", "sqllogictest-bin", "sqllogictest-engines", "tests"]

[workspace.package]
version = "0.17.2"
version = "0.18.0"
edition = "2021"
homepage = "https://github.com/risinglightdb/sqllogictest-rs"
keywords = ["sql", "database", "parser", "cli"]
Expand Down
4 changes: 2 additions & 2 deletions sqllogictest-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ glob = "0.3"
itertools = "0.11"
quick-junit = { version = "0.3" }
rand = "0.8"
sqllogictest = { path = "../sqllogictest", version = "0.17" }
sqllogictest-engines = { path = "../sqllogictest-engines", version = "0.17" }
sqllogictest = { path = "../sqllogictest", version = "0.18" }
sqllogictest-engines = { path = "../sqllogictest-engines", version = "0.18" }
tokio = { version = "1", features = [
"rt",
"rt-multi-thread",
Expand Down
2 changes: 1 addition & 1 deletion sqllogictest-engines/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ postgres-types = { version = "0.2.5", features = ["derive", "with-chrono-0_4"] }
rust_decimal = { version = "1.30.0", features = ["tokio-pg"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sqllogictest = { path = "../sqllogictest", version = "0.17" }
sqllogictest = { path = "../sqllogictest", version = "0.18" }
thiserror = "1"
tokio = { version = "1", features = [
"rt",
Expand Down
Loading

0 comments on commit 7ee44cd

Please sign in to comment.