testing-hashql
Guidelines for testing HashQL code using compiletest (UI tests), unit tests, and insta snapshots. Includes commands for --bless, annotation syntax, and strategies for compiler components.
Introduction
The testing-hashql skill provides a comprehensive framework for validating HashQL components, including the compiler pipeline, MIR/HIR/AST passes, and syntax parsing. It acts as an essential guide for engineers working within the Hash monorepo to ensure high-quality code and reliable diagnostic reporting. By categorizing testing needs—ranging from error message validation via compiletest to logic verification using standard Rust unit tests—this skill helps developers select the appropriate testing harness for their specific task.
-
Full support for compiletest (UI tests) workflows, including diagnostic annotations (//
, //^, //~|), test file structure requirements, and the --bless flag for automatically updating expected test outputs. -
Detailed usage guidance for the insta crate to perform snapshot testing in pipeline crates (mir, hir, ast), core modules, and parser fragments.
-
Specific instructions for MIR builder tests, utilizing the body! macro to programmatically define MIR bodies for complex pass isolation and edge case verification.
-
Integrated documentation for standardized testing commands, enabling efficient execution via cargo run -p hashql-compiletest or cargo nextest.
-
Guidelines for interpreting the test results, such as handling the Changed enum in MIR transformations and managing snapshot reviews through insta review and insta accept.
-
Prefer compiletest by default for all compiler-related behavior and diagnostic/error message reporting.
-
Use unit tests located in #[cfg(test)] modules for internal logic and helper functions.
-
Reserve insta snapshots for cases where compiletest is infeasible or for specific parser/core components.
-
When defining tests in tests/ui/, ensure the presence of .spec.toml for suite specifications.
-
If a required MIR construct is missing in the body! macro, do not use manual workarounds; instead, request a feature enhancement to the macro system.
-
Always keep snapshots colocated with their corresponding test categories to maintain repository organization.
Repository Stats
- Stars
- 1,533
- Forks
- 118
- Open Issues
- 66
- Language
- Rust
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- Apr 29, 2026, 12:50 PM