Skip to main content

Crate lanekeep_testkit

Crate lanekeep_testkit 

Source
Expand description

Fixture-based rule testing harness for lanekeep.

RuleTester: the harness every rule is tested through.

This is not optional infrastructure. Without it, community rule contributions are unreviewable — a reviewer cannot tell a rule that works from one that happens not to have been tried on the case it gets wrong.

§It runs the real path

A tester builds a throwaway project on disk and runs the actual engine over it: real config loading, real gates, real sandbox, real query matching. Nothing is stubbed.

That costs more than calling a handler directly, and buys the thing that matters. A rule can be correct in isolation and still never fire because its gate excludes the file, its query does not compile against the language it named, or its card fails validation. A harness that skipped those would pass rules that do nothing.

§Usage

use lanekeep_testkit::RuleTester;

let tester = RuleTester::new("no-debugger", RULE_SOURCE).expect("builds");
tester.accepts("const a = 1;").expect("clean code passes");
tester.reports_at("debugger;", &[(1, 1)]).expect("violations are found");

Structs§

RuleTester
A rule under test, with a throwaway project to run it in.

Enums§

TestError
Why a rule test could not run, or did not hold.