Permalink
Browse files

Stub test suite

  • Loading branch information...
1 parent b217920 commit 68f4577c9279d7ae385388946acd83ee27a683e9 @bytbox committed May 23, 2012
Showing with 36 additions and 3 deletions.
  1. +11 −3 format.cabal
  2. +25 −0 test.hs
View
@@ -9,8 +9,16 @@ author: Scott Lawrence
maintainer: bytbox@gmail.com
category: Text
build-type: Simple
-cabal-version: >=1.8
+cabal-version: >=1.10
library
- exposed-modules: Text.Format
- build-depends: base ==4.5.*, parsec ==3.1.*
+ default-language: Haskell2010
+ exposed-modules: Text.Format
+ build-depends: haskell2010 ==1.*, parsec ==3.1.*
+
+test-suite test
+ default-language: Haskell2010
+ type: exitcode-stdio-1.0
+ main-is: test.hs
+ build-depends: haskell2010 ==1.*, parsec ==3.1.*, QuickCheck==2.4.*
+
View
25 test.hs
@@ -0,0 +1,25 @@
+module Main where
+
+import System.Exit (exitSuccess, exitFailure)
+import Test.QuickCheck
+import Text.Format
+
+prop_id :: Int -> Bool
+prop_id = const True
+
+prop_id' :: Int -> Bool
+prop_id' = const False
+
+tests = [ ("Good", prop_id)
+ , ("Bad", prop_id')
+ ]
+
+isSuccess (Success _ _ _) = True
+isSuccess _ = False
+
+main = do
+ r <- mapM (\(n, p) -> putStr n >> quickCheckResult p) tests
+ if and $ map isSuccess r
+ then exitSuccess
+ else exitFailure
+

0 comments on commit 68f4577

Please sign in to comment.