haskell - cabal misconfiguration for tests -
my .cabal file contains following hspec configuration:
-- name of package. name: mymodule version: 0.1.0.0 cabal-version: >=1.10 ... test-suite my-tests ghc-options: -wall -werror cpp-options: -dtest default-extensions: overloadedstrings type: exitcode-stdio-1.0 main-is: hspectests.hs hs-source-dirs: tests build-depends: mymodule, base >= 4.8 && < 4.9, containers >= 0.5 && <0.6, split >= 0.2 && < 0.3, hspec default-language: haskell2010 my directory structure follows:
myproject | - src | - main.hs | - other.hs | - tests | -hspectests.hs | - dist | - myproj.cabal when run cabal build, source build succesfully executable ./dist/build/myproj/myproj.
cabal build fails with:
cabal: can't find source hspectests in dist/build/my-tests/my-tests-tmp, tests inspecting build directory shows my-tests directory missing.
changing hs-source-dirs src/tests produces:
cabal: can't find source hspectests in dist/build/my-tests/my-tests-tmp, src/tests while moving tests top level under root/tests, , changing .cabal file hs-source-dirs: tests produces:
<command line>: cannot satisfy -package-id mymodule-0.1.0.0-inplace (use -v more information) how have misconfigured this?
your hs-source-dirs wrong:
hs-source-dirs: tests given hspectests's path src/tests/hspectests.hs, should be
hs-source-dirs: src/tests however, keep in mind tests in top-level folder:
myproject | - src | - main.hs | - other.hs | - tests | -hspectests.hs | - dist | - myproj.cabal
Comments
Post a Comment