49 releases (19 breaking)

new 0.20.6 Jun 24, 2024
0.20.2 Apr 22, 2024
0.19.1 Jan 4, 2024
0.19.0 Nov 14, 2023
0.1.0 Dec 10, 2021

#159 in Database interfaces

Download history 16199/week @ 2024-03-04 14830/week @ 2024-03-11 17483/week @ 2024-03-18 14772/week @ 2024-03-25 13578/week @ 2024-04-01 12355/week @ 2024-04-08 12196/week @ 2024-04-15 13899/week @ 2024-04-22 10112/week @ 2024-04-29 12054/week @ 2024-05-06 13997/week @ 2024-05-13 13531/week @ 2024-05-20 12705/week @ 2024-05-27 12118/week @ 2024-06-03 11500/week @ 2024-06-10 12090/week @ 2024-06-17

49,023 downloads per month
Used in 5 crates

MIT/Apache

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

~8–18MB
~255K SLoC