Rust
Plain-English Rust tests. .rs.haiku files compile to integration tests and run via cargo test.
Status: available
.rs.haiku files describe what a Rust module or function should do in plain
English. Haiku compiles them to integration test files (<base>_test.rs) and
runs them through cargo test.
Filename
<base>.rs.haiku — e.g. cache.rs.haiku, haiku_parser.rs.haiku. The
generated test file is named <base>_test.rs and is written next to the
spec.
Frontmatter
| Field | Required | Notes |
|---|---|---|
intent | yes | One-line description |
sources | recommended | Ordered list of source files the test exercises, most-called first |
target.module | no | Legacy dotted module path |
target.context | no | Extra source files to feed the compiler |
Body
One natural-English assertion per line. Idiomatic Rust phrasings — variants,
Result returns, lifetimes — are fine; the compiler understands them.
Running
On the first run Haiku compiles to cache_test.rs and invokes cargo test --test cache_test. The generated file is placed under the nearest ancestor
Cargo.toml's tests/ directory so cargo picks it up as an integration
test.
Requirements
- A
Cargo.tomlsomewhere up the directory tree from the spec cargoonPATH