Skip to content
EN · PT

Gate: test-ref-matches-unit

A test reaches the unit its ref: names — by import, a name it defines, or a declared invocation.

Property Value
Checker test-ref-matches-unit
Confronts test
Blocking by default — new project yes
Blocking by default — existing project no — informs

A test can carry every code, match every title and assert — over a copy. In the reference app a test pasted the unit’s function into its own file and exercised the paste; another imported a neighbour; an end-to-end test’s ref: named one handler and invoked another. The gates that read titles saw nothing wrong, and the unit could change freely.

Two gates ask it on one routine, apart so the project decides per gate what blocks:

  • test-exercises-unit — the unit the project’s derivation pairs with the test (TestedUnits);
  • test-ref-matches-unit — the unit the test’s ref: names.

Reaching is read without knowing the language. A test reaches a unit when an import line names the unit’s module, when it names something the unit defines (the dialect’s definition says what a definition looks like), or — for the ref: — when a call the project declares on the gate (invocations) names it. A test that defines a name its unit defines is exercising a copy.

gates:
- name: test-ref-matches-unit
on: [test]
check: test-ref-matches-unit

Source: checker · its spec