SpecSheriff
rule · _guidelines/spec/3.3 · s-rah8b37kytb682y

The test comes before the code

Checkedconfirmed by its owner

When a rule is implemented, its test is written first and the code that implements it second, written to pass that test. The test carries the rule's sid in its name, or, in a language whose names cannot hold one, in a mark on the test (§s-rwqzepmrt77rv35); the code carries the rule's tag (§s-kgbzk2ph9e6jfb4).

Every test carries the sid of the rule or the term it verifies. A test a commit adds or changes carries the sid of a checked one, and every rule whose code a commit adds or changes has at least one test.

Why

A test names a rule's behaviour, which survives the refactoring that moves and renames the code underneath it, so the binding through tests is the stable one. And a test written first tests the rule, not whatever the code happened to do.

A term whose definition states behaviour is verified as a rule is, and its test carries the term's own sid rather than that of a rule written only to repeat it. A section and a domain's header require nothing (§s-ef93u6cnbs2sevr), and what a data record requires is carried out by the types and runtime checks generated from it (§s-e877bnfa559tvk9), which every commit holds to what the node produces, so a test of its own would verify the generator rather than the system's code.

A test without the sid of what it verifies tests something nobody can name, and a rule whose code has no test is carried out on trust; both are refused where the change is made, which is when a test costs least to write. Only a test a commit adds or changes must name a checked node, since a rule under revision is unchecked while the tests written against its earlier wording still stand.

The links it makes

The links made to it

The decisions taken on it

2026-10-07 · textual
Problem

Two tests added with a feature opened with no sid, and nothing checked that a test of the system's code names the rule it verifies.

Ruling

The owner: tags and tests that cite the specification are the general rule for all code, checked at every commit.

2026-10-07 · textual
Problem

Tests of what a term of contracts defines opened with the term's sid, which the rule as worded refused.

Ruling

The owner: a test opens with the sid of the checked rule or term it verifies.

2026-10-09 · textual
Problem

A test whose change only moved a citation onto a sid was held to open its name with the sid of a checked rule it verifies, which a test of a rule not yet checked cannot do, while a declaration changed only so owed no tag.

Ruling

The owner agreed that a change to a test that only rewrites its citations or its comments owes it no such name, as §s-kgbzk2ph9e6jfb4 already holds for a declaration.

2026-10-27 · textual
Problem

A test bound to its rule by the opening of its name cannot be written in a language whose names cannot hold a hyphen.

Ruling

The owner: a test declares the sid of what it verifies in the way its framework names a test (§s-rwqzepmrt77rv35).

2026-10-27 · textual
Problem

The rule let a test whose change only rewrote its citations or comments go without a sid, an exemption for tests written before tests carried sids, and it was worded for a reader who already knew the procedure.

Ruling

The owner: a test always carries the sid of what it verifies; the rule is worded as the procedure it is — the test first, the code second, the test carrying the rule's sid and the code its tag.

2026-10-31 · textual
Problem

A test could carry the sid of a node of a kind a project's own guidelines bind to tests, while the schema every project reads admits only the kinds it defines and nothing lets a project declare another; and the check accepted a test carrying the sid of any node, a section's included.

Ruling

The owner: the kinds of node are those the schema defines, the same in every project; a test carries the sid of a rule or a term.

2026-10-31 · textual
Problem

The reason called a rule with no test implemented, while a rule is implemented only with a passing test carrying its sid.

Ruling

Following the owner's ruling on §s-6fw72j65jkqrfpf: a rule whose code has no test is carried out on trust.

The tests bound to it