-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Description
With a directory layout (not so uncommon):
tests/Doctest.hs
tests/Spec.hs
tests/Spec/FooSpec.hs
and package.yaml
tests:
spec:
main: Spec.hs
source-dirs: test
doctest:
main: Doctest.hs
source-dirs: testthe following pkg.cabal is generated (only relevant parts):
test-suite doctest
type: exitcode-stdio-1.0
main-is: Doctest.hs
hs-source-dirs:
test
other-modules:
Spec
Spec.FooSpec
test-suite spec
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs:
test
other-modules:
Doctest
Spec.FooSpec
This haven't been a problem so-far as other-modules weren't yet passed to GHC by cabal-install for tests and benchmarks.
Newest cabal will however pass them, which will cause GHC to fail with
test/Doctest.hs:1:8: error:
File name does not match module name:
Saw: ‘Main’
Expected: ‘Doctest’
|
1 | module Main (main) where
The reason to pass other-modules is for GHC to avoid interleaving module
discovery (cabal-file already tells which modules to compile!) and compilation in GHC.
Even proper solution would be to have a way to turn off/configure module discovery per executable/test-suite/benchmark, in addition to filtering out main-is files.
tebello-thejane, icidasset, jml, fizruk and brandon-leapyear