Make cabal test work

Apparently QuickCheck doesn't exit on failure by itself.
This commit is contained in:
Steven Dee 2013-10-21 21:31:12 -04:00
parent fd70bf2fc8
commit 05c3ad6d2e
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,5 @@
name : hsnock
version : 0.1.3
version : 0.1.4
category : Language
license : PublicDomain
synopsis : Nock 5K interpreter.
@ -35,4 +35,7 @@ test-suite test
main-is : test.hs
build-depends : base >=4.5 && <5
, parsec >=3.1
, readline >=1.0
, QuickCheck >=2.6
, test-framework >=0.8
, test-framework-quickcheck2 >=0.3

11
test.hs
View File

@ -1,10 +1,12 @@
import Control.Applicative
import Language.Nock5K
import Test.Framework
import Test.Framework.Providers.QuickCheck2
import Test.QuickCheck
import Text.ParserCombinators.Parsec (parse)
import Text.Printf
main = mapM_ (\(s,a) -> printf "%-25s: " s >> a) tests
main = defaultMain tests
instance Arbitrary Noun where
arbitrary = choose (0, 32) >>= arbD
@ -33,6 +35,7 @@ prop_6_is_if a' b = nock (ifs $ Atom 0) == Atom (a + 1) && nock (ifs $ Atom 1) =
ifs c = Atom a :- Atom 6 :- (Atom 1 :- c) :- (Atom 4 :- Atom 0 :- Atom 1) :- (Atom 1 :- b)
a = abs a'
tests = [("parse_show", quickCheck prop_parse_show)
,("decrement", quickCheck prop_dec)
,("6_is_if", quickCheck prop_6_is_if)]
tests = [ testProperty "parse.show" prop_parse_show
, testProperty "decrement" prop_dec
, testProperty "6_is_if" prop_6_is_if
]