I am trying to make some unit tests in Haskell and this is basically what I have done in my code:
module Test where
import Test.HUnit
test = TestList [TestLabel "running all the tests!"
$ TestList [
. . . . .
]]
run = runTestTT tests
When I try to compile it with the gchi I get this message:
Could not find module ‘Test.HUnit’
Use -v to see a list of the files searched for.
Failed, modules loaded: none
How can I make HUnit work?
I am using GHCi version 7.8.3
Thanks
I tried installing HUnit through cabal as an answer suggested but then I got the error:
Could not find module ‘Test.HUnit’ Perhaps you haven't installed the "dyn" libraries for
package ‘HUnit-1.2.5.2’?
Use -v to see a list of the files searched for.
Then I used the command:
cabal install base
and I got this message:
Resolving dependencies...
All the requested packages are already installed:
base-4.7.0.1
Use --reinstall if you want to reinstall anyway.
So I used the command:
cabal install base -reinstall
to reinstall just in case and I got the message:
Resolving dependencies...
cabal: Could not resolve dependencies:
rejecting: base-4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0, 4.5.0.0, 4.4.1.0,
4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0, 4.1.0.0, 4.0.0.0 (only
already installed instances can be used)
rejecting: base-3.0.3.2 (conflict: base => base>=4.0 && <4.3)
rejecting: base-3.0.3.1 (conflict: base => base>=4.0 && <4.2)
What should I do?
Turns out I had mistakenly installed two versions of ghc (7.6.3 and 7.8.3) so I removed them both along with cabal and reinstalled everything. Now it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With