カバールでユニットテストを実行するのに驚くほどの難しさがあります。私はテストを構築しようとすると、私は次のメッセージを取得し、しかしカバールテストでdetailed-0.9を使用する方法
{-# LANGUAGE FlexibleInstances #-}
module Test.Integral (tests) where
import Distribution.TestSuite
instance TestOptions (String, Bool) where
name = fst
options = const []
defaultOptions _ = return (Options [])
check _ _ = []
instance PureTestable (String, Bool) where
run (name, result) _ | result == True = Pass
| result == False = Fail (name ++ " failed!")
test :: (String, Bool) -> Test
test = pure
-- In actual usage, the instances 'TestOptions (String, Bool)' and
-- 'PureTestable (String, Bool)', as well as the function 'test', would be
-- provided by the test framework.
tests :: [Test]
tests =
[ test ("bar-1", True)
, test ("bar-2", False)
]
をモジュール名を変更した以外は、the cabal documentationからそのままテストコードをコピーした:
Test/Integral.hs:6:10:
Not in scope: type constructor or class `TestOptions'
Test/Integral.hs:12:10:
Not in scope: type constructor or class `PureTestable'
私はDistribution.TestSuiteから直接インポートしようとしましたが、エクスポートされていないと言いました。これは私が何か愚かなことをしなければならないほど簡単ですが、私はそれが何かを見ることができません。
'TestOptions'らはquickcheckの古い古いバージョンを参照するように見えます。現代のテストフレームワークを使用することをお勧めします(あなたが見ているのは、カバールを介してテストスイートを実行するためのフレームワークであり、実際のスイートを構築するのではなく、おいしいフレームやテストフレームワークを学ぶことです)。 –