How to load tests in ghci with glass

I created a very simple project with glass. It contains: an executable file, a library, and test targets in the associated cabal file. When I load the code into ghci via the ghci stack, I cannot access the test there, even if it is in a separate module. Is there any way to use it this way?

+7
haskell cabal haskell-stack
source share
1 answer

Try stack ghci (your project name):(the test suite name) . Then you can enter main and your tests will run.

Example:

If your .cabal project file had the following meanings:

 name: ExampleProject ... test-suite Example-test 

Then the command to run will be stack ghci ExampleProject:Example-test

(editing suggested by @Chris Stryczynski)

To see the test and src directories so that they are updated on reboot with :r , run:

 stack ghci --ghci-options -isrc --ghci-options -itest ExampleProduct:Example-test 
+9
source share

All Articles