45 releases (19 breaking)
0.20.2 | Apr 22, 2024 |
---|---|
0.19.1 | Jan 4, 2024 |
0.19.0 | Nov 14, 2023 |
0.15.2 | Jul 31, 2023 |
0.1.0 | Dec 10, 2021 |
#127 in Database interfaces
49,345 downloads per month
Used in 5 crates
115KB
2.5K
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
~7–18MB
~255K SLoC