Skip to content

Commit

Permalink
fix query/statement error unexpected passed when result is `stateme…
Browse files Browse the repository at this point in the history
…nt/query ok` (#187)

Co-authored-by: xxchan <[email protected]>
  • Loading branch information
JackTan25 and xxchan authored Jul 24, 2023
1 parent ff89483 commit 6afd335
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-semver-checks --version ^0.17 --locked
args: cargo-semver-checks --version ^0.22 --locked
- name: Check semver
run: |
cargo semver-checks check-release -p sqllogictest
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## [0.15.1] - 2023-07-24

* fix `statement error` unexpectedly passed when result is a successful `query`. Similarly for expected `query error` but successful `statement ok`.

## [0.15.0] - 2023-07-06

* Allow multiple connections to the database in a single test case, which is useful for testing the transaction behavior. This can be achieved by attaching a `connection foo` record before the query or statement.
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 @@ -2,7 +2,7 @@
members = ["sqllogictest", "sqllogictest-bin", "sqllogictest-engines", "tests"]

[workspace.package]
version = "0.15.0"
version = "0.15.1"
edition = "2021"
homepage = "https://github.com/risinglightdb/sqllogictest-rs"
keywords = ["sql", "database", "parser", "cli"]
Expand Down
26 changes: 25 additions & 1 deletion sqllogictest/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -679,16 +679,40 @@ impl<D: AsyncDB, M: MakeConnection<Conn = D>> Runner<D, M> {
match (record.clone(), self.apply_record(record).await) {
(_, RecordOutput::Nothing) => {}
// Tolerate the mismatched return type...
(Record::Statement { .. }, RecordOutput::Query { error: None, .. }) => {}
(
Record::Statement {
sql,
expected_error,
loc,
..
},
RecordOutput::Query { error: None, .. },
) => {
if expected_error.is_some() {
return Err(TestErrorKind::Ok {
sql,
kind: RecordKind::Query,
}
.at(loc));
}
}
(
Record::Query {
expected_results,
loc,
sql,
expected_error,
..
},
RecordOutput::Statement { error: None, .. },
) => {
if expected_error.is_some() {
return Err(TestErrorKind::Ok {
sql,
kind: RecordKind::Query,
}
.at(loc));
}
if !expected_results.is_empty() {
return Err(TestErrorKind::QueryResultMismatch {
sql,
Expand Down

0 comments on commit 6afd335

Please sign in to comment.