-
Notifications
You must be signed in to change notification settings - Fork 348
Closed
Description
Loading a file in a cabal project's test suite that links to a library defined in the project with inferior-haskell-load-file (C-c C-l) fails.
For example. Given a project layout such as:
src/Foo/Bar.hs
foo.cabal
test.hs
foo.cabal
name: foo
-- ...
library
-- ...
hs-source-dirs: src
exposed-modules: Foo.Bar
test-suite test-foo
type: exitcode-stdio-1.0
main-is: test.hs
build-depends: base >=4.9 && <4.10,
foo
test.hs:
module Main where
import Foo.Bar
main :: IO ()
main = -- ...
Running C-c C-l
from test.hs
fails with:
test.hs:3:1: error:
Failed to load interface for ‘Foo.Bar’
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
The proper way to load a file in the test suite with cabal is to run cabal repl <test target>
; in this case cabal repl test-foo
, which will work correctly. See the comment here: haskell/cabal#2032 (comment)
I can get around this by C-u M-x inferior-haskell-start-process cabal repl test-foo
. Once you figure that out, it's not so difficult, but I wonder if there could be more intelligent loading of test files?
Metadata
Metadata
Assignees
Labels
No labels