crem icon indicating copy to clipboard operation
crem copied to clipboard

Doctests on crem-examples not working on nix

Open marcosh opened this issue 2 years ago • 0 comments

When running nix build -L ".#crem.ghc90" with doctests in crem-examples, I get

crem> Could not import module: Crem.Example.TwoSwitchesGate. This can be caused by a number of issues:                                                                                                                                      
crem>  1. A module found by GHC contained tests, but was not in 'exposed-modules'. If you want                                                                                                                                              
crem>     to test non-exposed modules follow the instructions here:                                                                                                                                                                         
crem>     https://github.com/martijnbastiaan/doctest-parallel#test-non-exposed-modules                                                                                                                                                      
crem>  2. For Cabal users: Cabal did not generate a GHC environment file. Either:                                                                                                                                                           
crem>    * Run with '--write-ghc-environment-files=always'                                                                                                                                                                                  
crem>    * Add 'write-ghc-environment-files: always' to your cabal.project                                                                                                                                                                  
crem>  3. For Cabal users: Cabal did not generate a GHC environment file in time. This                                                                                                                                                      
crem>     can happen if you use 'cabal test' instead of 'cabal run doctests'. See                                                                                                                                                           
crem>     https://github.com/martijnbastiaan/doctest-parallel/issues/22.                                                                                                                                                                    
crem>  4. The testsuite executable does not have a dependency on your project library. Please                                                                                                                                               
crem>     add it to the 'build-depends' section of the testsuite executable.                                                                                                                                                                
crem> See the example project at https://github.com/martijnbastiaan/doctest-parallel/blob/main/example/README.md for more information.                                                                                                      
crem> The original reason given by GHCi was:                                                                                                                                                                                                
crem> Error:                                                                                                                                                                                                                                
crem> <no location info>: error:                                                                                                                                                                                                            
crem>     Could not load module ‘Crem.Example.TwoSwitchesGate’                                                                                                                                                                              
crem>     It is a member of the hidden package ‘crem-0.1.0.0:crem-examples’.                                                                                                                                                                
crem>     You can run ‘:set -package crem’ to expose it.                                                                                                                                                                                    
crem>     (Note: this unloads all the modules in the current scope.)

marcosh avatar Feb 27 '23 16:02 marcosh