6

Haskell でいくつかの単体テストを作成しようとしていますが、これは基本的にコードで行ったことです。

module Test where
import Test.HUnit
test = TestList [TestLabel "running all the tests!"
$ TestList [
. . . . .
]]  

run = runTestTT tests   

gchi でコンパイルしようとすると、次のメッセージが表示されます。

 Could not find module ‘Test.HUnit’
Use -v to see a list of the files searched for.
Failed, modules loaded: none

HUnitを機能させるにはどうすればよいですか?

GHCi バージョン 7.8.3 を使用しています

ありがとう

編集:

回答が示唆したように、cabal を介して HUnit をインストールしようとしましたが、エラーが発生しました。

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.

次に、次のコマンドを使用しました。

cabal install base

そして、私はこのメッセージを受け取りました:

Resolving dependencies...
All the requested packages are already installed:
base-4.7.0.1
Use --reinstall if you want to reinstall anyway.

だから私はコマンドを使用しました:

cabal install base -reinstall

念のため再インストールすると、次のメッセージが表示されました。

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)

私は何をすべきか?

4

1 に答える 1

1

ghc の 2 つのバージョン (7.6.3 と 7.8.3) を誤ってインストールしたことが判明したため、cabal と共に両方を削除し、すべてを再インストールしました。今それは動作します!

于 2014-11-02T14:32:52.960 に答える