Skip to content

Commit 7ee44cd

Browse files
authored
feat: match multiline error (#200)
* multiline line error Signed-off-by: Bugen Zhao <i@bugenzhao.com> * fix unparse Signed-off-by: Bugen Zhao <i@bugenzhao.com> * add tests Signed-off-by: Bugen Zhao <i@bugenzhao.com> * add docs Signed-off-by: Bugen Zhao <i@bugenzhao.com> * bump version and add changelog Signed-off-by: Bugen Zhao <i@bugenzhao.com> * add empty variant to make it more clear Signed-off-by: Bugen Zhao <i@bugenzhao.com> * refine display impl Signed-off-by: Bugen Zhao <i@bugenzhao.com> --------- Signed-off-by: Bugen Zhao <i@bugenzhao.com>
1 parent 52d5122 commit 7ee44cd

File tree

9 files changed

+338
-76
lines changed

9 files changed

+338
-76
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
## [0.18.0] - 2023-11-08
11+
12+
* Support matching multiline error message under `----` for both `statement error` and `query error`.
13+
```
14+
query error
15+
SELECT 1/0;
16+
----
17+
db error: ERROR: Failed to execute query
18+
19+
Caused by these errors:
20+
1: Failed to evaluate expression: 1/0
21+
2: Division by zero
22+
```
23+
24+
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.
25+
26+
Empty lines are allowed in the expected error message. As a result, the message must end with two consecutive empty lines.
27+
28+
Breaking changes in the parser:
29+
- Add new variants to `ParseErrorKind`. Mark it as `#[non_exhaustive]`.
30+
- Change the type of `expected_error` from `Regex` to `ExpectedError`, which is either a inline `Regex` or multiline `String`.
31+
1032
## [0.17.2] - 2023-11-01
1133

1234
* 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`.

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resolver = "2"
33
members = ["sqllogictest", "sqllogictest-bin", "sqllogictest-engines", "tests"]
44

55
[workspace.package]
6-
version = "0.17.2"
6+
version = "0.18.0"
77
edition = "2021"
88
homepage = "https://github.com/risinglightdb/sqllogictest-rs"
99
keywords = ["sql", "database", "parser", "cli"]

sqllogictest-bin/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ glob = "0.3"
2424
itertools = "0.11"
2525
quick-junit = { version = "0.3" }
2626
rand = "0.8"
27-
sqllogictest = { path = "../sqllogictest", version = "0.17" }
28-
sqllogictest-engines = { path = "../sqllogictest-engines", version = "0.17" }
27+
sqllogictest = { path = "../sqllogictest", version = "0.18" }
28+
sqllogictest-engines = { path = "../sqllogictest-engines", version = "0.18" }
2929
tokio = { version = "1", features = [
3030
"rt",
3131
"rt-multi-thread",

sqllogictest-engines/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ postgres-types = { version = "0.2.5", features = ["derive", "with-chrono-0_4"] }
1919
rust_decimal = { version = "1.30.0", features = ["tokio-pg"] }
2020
serde = { version = "1", features = ["derive"] }
2121
serde_json = "1"
22-
sqllogictest = { path = "../sqllogictest", version = "0.17" }
22+
sqllogictest = { path = "../sqllogictest", version = "0.18" }
2323
thiserror = "1"
2424
tokio = { version = "1", features = [
2525
"rt",

0 commit comments

Comments
 (0)