ExSQL.SqlLogicTest (exsql v0.1.5)

Copy Markdown

A runner for SQLite's sqllogictest conformance corpus (https://sqlite.org/sqllogictest) — the cross-engine suite of millions of generated queries with stored results.

Each .test file is a sequence of records:

statement ok          -- DDL/DML that must succeed
statement error       -- a statement that must fail
query <types> <sort>  -- a query whose flattened, formatted, sorted
SELECT ...               values must match the stored lines or the
----                     stored `N values hashing to <md5>` digest
<expected values>

skipif sqlite / onlyif <engine> conditions are honored as the engine named "sqlite", since ExSQL implements SQLite semantics. Statement failures abort the rest of the file (the schema has diverged); query failures are counted and execution continues.

ExSQL.SqlLogicTest.run_file("path/to/select1.test")
#=> %{ok: 990, fail: 10, skip: 0, aborted: false, failures: [...]}

Pass max_records: n to run only the first n parsed records in a large corpus file.

Summary

Functions

Runs one corpus file against a fresh database.

Runs corpus content (for tests and tools).

Types

stats()

@type stats() :: %{
  ok: non_neg_integer(),
  fail: non_neg_integer(),
  skip: non_neg_integer(),
  aborted: boolean(),
  failures: [map()]
}

Functions

run_file(path, opts \\ [])

@spec run_file(
  Path.t(),
  keyword()
) :: stats()

Runs one corpus file against a fresh database.

run_string(content, name \\ "(inline)", opts \\ [])

@spec run_string(String.t(), String.t(), keyword()) :: stats()

Runs corpus content (for tests and tools).