Skip to main content

Module testfiles

Module testfiles 

Source
Expand description

One answer to “is this a test file”.

There used to be two: a per-language dispatch in edges::structural::testing gating TestEdge emission, and a flat suffix list in utility::needs gating test-need match strength. They disagreed — a .kts file was a test to one and not the other — so the two halves of “this is a test for the changed code” could each hold independently (#182).

Both also accepted any stem ending in test, because the JVM and Scala conventions carry no separator (FooTest.java) and both lowercased the name before comparing, which destroys the CamelCase boundary that makes the convention readable. That matched latest, greatest, contest and attest. The rule here is that a test/spec marker counts only at a word boundary: its own segment between separators, or a capitalised Test/Spec in the original name.

Two families are accepted false positives, because no name-based rule separates them: PodSpec/JobSpec (Kubernetes API types) look exactly like AuthSpec (a Scala test), and ABTest (an experiment) looks exactly like FooTest. Both over-classify — a K8s model contributes test-need strength it should not — and both are preferred to under-classifying the conventions they collide with, which are far more common in the corpora this feeds.

Functions§

is_test_path
Whether path is test material.