Skip to content

Commit fdb6964

Browse files
committed
test(distributions): check the linked DuckDB version through a case table
The version test now lists its queries as value cases, as the other tests do, and also reads the library version from pragma_version.
1 parent f266115 commit fdb6964

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

‎crates/sqlquack/tests/cli/test_bundled.rs‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::helpers::{convert_outcome, run_convert};
2-
use crate::test_types::ConvertTestCase;
2+
use crate::test_types::{ConvertTestCase, ValueTestCase};
33

44
// The distributions workflow also runs this test and the full convert test in test_convert.rs with
55
// DuckDB compiled in (`--features bundled`), as the wheels build it.
@@ -43,9 +43,27 @@ fn given_zone_free_snowflake_sql_when_converting_then_the_checking_engine_binds_
4343
// it. The distributions workflow runs this with DuckDB compiled in as well.
4444
#[test]
4545
fn given_the_linked_duckdb_when_asked_its_version_then_it_names_the_pinned_release() {
46+
let test_cases = [
47+
ValueTestCase {
48+
description: "version() names the release, not a dev build",
49+
sql: "SELECT version()",
50+
expected_value: "v2.0.0",
51+
},
52+
ValueTestCase {
53+
description: "pragma_version's library version names the same release",
54+
sql: "SELECT library_version FROM pragma_version()",
55+
expected_value: "v2.0.0",
56+
},
57+
];
4658
let connection = duckdb::Connection::open_in_memory().expect("in-memory DuckDB opens");
47-
let version: String = connection
48-
.query_row("SELECT version()", [], |row| row.get(0))
49-
.expect("DuckDB reports its version");
50-
assert_eq!(version, "v2.0.0", "the DuckDB release SQLQuack pins");
59+
for test_case in test_cases {
60+
let version: String = connection
61+
.query_row(test_case.sql, [], |row| row.get(0))
62+
.expect(test_case.description);
63+
assert_eq!(
64+
version, test_case.expected_value,
65+
"{}",
66+
test_case.description
67+
);
68+
}
5169
}

0 commit comments

Comments
 (0)