noir-frontend-tests
Writing noirc_frontend Unit Tests
Tests live under compiler/noirc_frontend/src/tests/. The root module tests.rs defines helpers and declares submodules organized by topic.
Helpers in tests.rs
Importable from submodules via use crate::tests::{...}.
Compilation
| Helper | Use when |
|---|---|
assert_no_errors(src) |
Program should compile without errors. Panics with "Expected no errors" and prints diagnostics. Returns Context. |
assert_no_errors_without_report(src) |
Same but doesn't print diagnostics on failure. |
get_program_errors(src) -> Vec<CompilationError> |
Get raw error list for manual inspection. |
get_program_using_features(src, &[UnstableFeature]) |
Compile with specific unstable features enabled. |
Error Checking with Inline Annotations
More from noir-lang/noir
noir-idioms
Guidelines for writing idiomatic, efficient Noir programs. Use when writing or reviewing Noir code.
43extract-fuzzer-repro
Extract a Noir reproduction project from fuzzer failure logs in GitHub Actions. Use when a CI fuzzer test fails and you need to create a local reproduction.
37noir-optimize-acir
Workflow for measuring and optimizing the ACIR circuit size of a constrained Noir program. Use when asked to optimize a Noir program's gate count or circuit size.
36bisect-ssa-pass
Workflow for debugging SSA pass semantic preservation using the noir-ssa CLI. Use when a program's behavior changes incorrectly during the SSA pipeline - bisects passes to identify which one breaks semantics. The `pass_vs_prev` fuzzer finds such issues automatically.
32debug-fuzzer-failure
End-to-end workflow for debugging SSA fuzzer failures from CI. Extracts a reproduction case from GitHub Actions logs, then bisects SSA passes to identify the bug. Use when a `pass_vs_prev` or similar fuzzer test fails in CI.
30reduce-ssa-repro
Minimize an SSA file that triggers a bug in the noir-ssa pipeline, producing the smallest possible reproduction case. Use after bisecting to identify which SSA passes cause the issue.
1