30 releases (12 breaking)
0.13.2 | Mar 25, 2023 |
---|---|
0.12.1 |
|
0.10.0 | Dec 16, 2022 |
0.8.0 | Nov 23, 2022 |
0.1.0 | Dec 10, 2021 |
#71 in Database interfaces
37,511 downloads per month
Used in 5 crates
87KB
2K
SLoC
Sqllogictest
Sqllogictest is a testing framework to verify the correctness of an SQL database. See GitHub Homepage for more information.
This crate implements a sqllogictest parser and runner library in Rust.
lib.rs
:
Sqllogictest parser and runner.
Usage
Implement [DB
] trait for your database structure:
struct Database {...}
impl sqllogictest::DB for Database {
type Error = ...;
fn run(&self, sql: &str) -> Result<String, Self::Error> {
...
}
}
Create a [Runner
] on your database instance, and then run the script:
let mut tester = sqllogictest::Runner::new(Database::new());
let script = std::fs::read_to_string("script.slt").unwrap();
tester.run_script(&script);
You can also parse the script and execute the records separately:
let records = sqllogictest::parse(&script).unwrap();
for record in records {
tester.run(record);
}
Dependencies
~5–12MB
~234K SLoC