skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
tursodatabase/turso1.3k installs

testing

How to write tests, when to use each type of test, and how to run them. Covers `.sqltest` files, Rust integration tests, and converting `.test` files to `.sqltest`

How do I install this agent skill?

npx skills add https://github.com/tursodatabase/turso --skill testing
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill provides a comprehensive guide for developers on how to write, convert, and execute tests within the project. It covers multiple test formats including .sqltest, TCL, and Rust integration tests, along with standard build tool commands. No security risks were identified.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerwarn

    1/1 file flagged

  • ZeroLeakspass

    Score: 93/100 · 2 sections analyzed

What does this agent skill do?

Testing Guide

Test Types

TypeLocationUse Case
.sqltestsqlite/conformance/sqlite-sqltests/SQL compatibility. Preferred for new tests
.sqltesttesting/shared-sqltests/SQL that both the SQLite and PostgreSQL frontends run
.sqltestpostgres/conformance/pg-sqltests/PostgreSQL frontend
Rust integrationtests/integration/Regression tests, multi-connection and storage scenarios
Fuzztests/fuzz/Edge cases found by fuzzing
TCL .testtesting/system/Legacy. Write new tests as .sqltest

Extend an existing test file before creating a new one.

Running Tests

make test                                   # TCL, sqlite3 compat, extensions, MVCC
make test-single TEST=select.test           # one TCL test
make -C sqlite/conformance run-rust ARGS='--snapshot-filter __never__'   # .sqltest runner
cargo test                                  # Rust unit and integration tests
cargo test -p core_tester --test leak_tests # per-database memory leak check (separate binary with a counting allocator)

make sets RUST_LOG=off.

Writing a .sqltest

@database :default:

test example-addition {
    SELECT 1 + 1;
}
expect {
    2
}

test example-multiple-rows {
    SELECT id, name FROM users WHERE id < 3;
}
expect {
    1|alice
    2|bob
}

To convert a TCL test: make -C sqlite/conformance convert INPUT=<file> OUTPUT=<dir>. The converter warns about parts it cannot convert, such as loops; write those by hand. .sqltest databases are generated with a different seed than the TCL ones, so change expected results, not the SQL.

Writing a Rust integration test

Use the helpers in tests/integration/:

use crate::common::{limbo_exec_rows, TempDatabase};

#[test]
fn test_something() {
    let db = TempDatabase::new_empty();
    let conn = db.connect_limbo();
    conn.execute("CREATE TABLE t(id INTEGER PRIMARY KEY, name TEXT)").unwrap();
    let rows = limbo_exec_rows(&conn, "SELECT id, name FROM t");
    // ...
}

For anything beyond trivial checks, use the asserting crate (assert_that!, verify_that!). tests/integration/ also has row!, .column(n) and query-plan assertions such as .uses_index("idx").

Rules

  • Every functional change gets a test that fails without the change and passes with it.
  • Prefer in-memory databases.
  • Follow the existing test formats.

Test Database

testing/system/testing.db has users and products tables. Schema: docs/testing.md.

Logging

Trace logs from the engine: RUST_LOG=turso_core=trace cargo test <name> -- --nocapture (very verbose). make overrides RUST_LOG to off.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/tursodatabase/turso/testing">View testing on skillZs</a>