मुझे कैबल के तहत यूनिट परीक्षण चलाने में आश्चर्यजनक मात्रा में समस्या आ रही है। मैं the cabal documentation से शब्दशः परीक्षण कोड कॉपी किया है, मॉड्यूल का नाम बदलने केकैबेल परीक्षण में विस्तृत-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)
]
हालांकि, जब मैं परीक्षण बनाने की कोशिश के अपवाद के साथ, मैं निम्न संदेश मिलता है:
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'
मैं उन्हें वितरण से सीधे आयात करने का प्रयास किया। टेस्टसुइट, लेकिन यह कहा गया कि उन्हें निर्यात नहीं किया गया था। यह इतना आसान है कि मुझे कुछ बेवकूफ करना है, लेकिन मैं नहीं देख सकता कि यह क्या है।
'TestOptions' एट अल quickcheck के एक पुराने पुराने संस्करण की चर्चा करते हुए दिखाई देते हैं। मेरा सुझाव है कि आप एक आधुनिक टेस्ट फ्रेमवर्क का उपयोग करें (ऐसा लगता है कि आप जो देख रहे हैं वह केवल कैब के माध्यम से परीक्षण सूट चलाने के लिए एक फ्रेमवर्क है, वास्तविक सूट का निर्माण नहीं - स्वादिष्ट या टेस्ट-फ्रेमवर्क सीखें)। –