passsy / parity-tests-for-shared-behaviorr3
Prove Parity Between Paths That Claim to Agree
PublicWhen two public paths claim the same behavior, add tests that pin them to each other on the tricky inputs so they cannot drift apart.
detector.tsisolate · reads files, writes none · no network · 100 ms · 32 MBEdit
import { mentioned, onPrompt } from "@wellactually/sdk/v3";
import { isDartProject } from "dart-kit";
/**
* The handbook ships this rule without a detector: noticing that two paths
* drift needs the diff and both files at once. What is honest is a name that
* can only mean this topic, so the rule points at itself when the user asks
* for a parity test, and stays silent otherwise.
*/
onPrompt({
*detect(event) {
if (isDartProject(event)) {
yield* mentioned(event, ["parity test", "parity tests"]);
}
},
});
fixtures/dart_app/pubspec.yamlEdit
namedemo
package.jsonEdit
{
"name": "parity-tests-for-shared-behavior",
"private": true,
"dependencies": {
"dart-kit": "*"
}
}