@@ -1,4 +1,4 @@
1−module Tests.Property where
1+module Test.Property where
3import Control.Applicative ((<*))
3import Control.Applicative ((<*))
4import Test.Framework
4import Test.Framework
@@ -17,7 +17,8 @@ import Parse.Helpers (IParser, iParse)
17import Parse.Literal (literal)
17import Parse.Literal (literal)
18import qualified Parse.Pattern as Pat (expr)
18import qualified Parse.Pattern as Pat (expr)
19import qualified Parse.Type as Type (expr)
19import qualified Parse.Type as Type (expr)
20−import Tests.Property.Arbitrary
20+import Test.Property.Arbitrary
22propertyTests :: Test
23propertyTests :: Test
23propertyTests =
24propertyTests =
@@ -48,9 +49,20 @@ propertyTests =
48 , P.Var "su'BrrbPUK6I33Eq"
49 , P.Var "su'BrrbPUK6I33Eq"
51prop_parse_print :: (Pretty a, Arbitrary a, Eq a) => IParser a -> a -> Bool
53prop_parse_print :: (Pretty a, Arbitrary a, Eq a) => IParser a -> a -> Bool
52−prop_parse_print p x =
54+prop_parse_print parser value =
53− either (const False) (== x) . parse_print p $ x
55+ either (const False) (== value) (parse_print parser value)
55parse_print :: (Pretty a) => IParser a -> a -> Either String a
58parse_print :: (Pretty a) => IParser a -> a -> Either String a
59+parse_print parser value =
56−parse_print p = either (Left . show) Right . iParse (p <* eof) . P.renderStyle P.style {mode=P.LeftMode} . pretty
64+ P.renderStyle P.style { mode = P.LeftMode } doc
66+ case iParse (parser <* eof) string of
67+ Left msg -> Left (show msg)