unit-testing

Write hermetic Rust unit tests for Searchlite core behaviors.

Updated Dec 20, 2025
One-click install
npx skills add https://github.com/davidkelley/searchlite --skill unit-testing-davidkelley
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unit-testing
Source: https://github.com/davidkelley/searchlite/tree/main/.codex/skills/unit-testing
Command: npx skills add https://github.com/davidkelley/searchlite --skill unit-testing-davidkelley

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides patterns for adding and maintaining unit tests in the Searchlite workspace; use when writing or updating Rust tests for core behaviors.

Core Features & Use Cases

  • Hermetic, deterministic unit tests for Rust modules
  • Fixture guidance using tempfile::tempdir, minimal schema, and small test corpora
  • Categories to cover: schema validation, write lifecycle, durability, query correctness, ranking, and nested/filters
  • Quick example: create small test modules under searchlite-core and run cargo test to verify correctness.

Quick Start

  • Create a new test module in your Rust project.
  • In tests, import the test utilities and use tempfile::tempdir() to create isolated workspaces.
  • Run cargo test to verify core behaviors.

Frequently Asked Questions about unit-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write hermetic unit tests in Rust that stay deterministic?

You can write hermetic unit tests by using tempfile::tempdir for isolated workspaces, defining minimal schemas, and importing test utilities in your Rust modules to ensure deterministic execution.

What's the best way to structure Rust test fixtures for a database workspace?

The best way to structure Rust test fixtures is using tempfile::tempdir for isolation, minimal schema definitions, and small test corpora to validate schema, write lifecycles, and query correctness reliably.

How do I test query correctness and ranking in Rust?

To test query correctness and ranking in Rust, create small test modules with minimal schema fixtures and small test corpora, then run cargo test to verify nested filter behaviors and ranking accuracy.

Can I use this unit testing approach for schema validation and durability tests?

Yes, this unit testing approach supports schema validation and durability tests by providing reusable fixture templates and clear patterns to verify write lifecycles and data persistence using isolated tempdir workspaces.

Why do my Rust unit tests fail when testing write lifecycles and nested filters?

Rust unit tests often fail due to non-hermetic environments; using tempfile::tempdir for isolated workspaces and minimal schema fixtures ensures deterministic write lifecycle and nested filter behavior validation.