d2d3096f

Created Started Cancelled

Do not read the discovery entry point as a test file

A package's `test/Spec.hs` is what `sydtest-discover` generates the entry point
from, and its module header is written by the preprocessor. It ends in
`Spec.hs`, so `moduleContextIsSpecFile` read it as a test file, and
`HsTestOneSpecPerFile` then reported that it has no export list.

There is nothing in that file for the rule to read and no way to give it one:
the module header does not exist in the source. `TestNoTestHelpers` shares the
predicate and had the same problem.

Found by running the two new rules over a repository with 15 packages, where
every one of those `test/Spec.hs` files was a finding nobody could act on.

### What changed

`isSpecFilePath :: Path Rel File -> Bool` is now the one place that says what a
test file is, as a function of the path rather than a field of a context, so it
can be asked and tested directly. It reads the name off the file rather than
matching a suffix of the whole path, which is what the suffix was reaching for,
and it excludes the name `Spec.hs` itself.

`hopinion-gen/test/Hopinion/Facts/ModuleSpec.hs` covers it. The
discovery-entry-point case fails without the change and passes with it; the
other 499 tests in the suite pass either way.

No golden moved: no rule resource is named `Spec.hs`, so nothing that was
already covered changes behaviour.
PR #9