1module Tests.Property where
3import Control.Applicative ((<*))
5import Test.Framework.Providers.HUnit
6import Test.Framework.Providers.QuickCheck2
7import Test.HUnit (assert)
9import Text.Parsec.Combinator (eof)
10import Text.PrettyPrint as P
12import SourceSyntax.Literal as Lit
13import SourceSyntax.Pattern as Pat
14import SourceSyntax.PrettyPrint (Pretty, pretty)
15import Parse.Helpers (IParser, iParse)
16import Parse.Literal (literal)
17import qualified Parse.Pattern as Pat (expr)
18import qualified Parse.Type as Type (expr)
19import Tests.Property.Arbitrary
23 testGroup "Parse/Print Agreement Tests"
25 testCase "Long Pattern test" $ assert (prop_parse_print Pat.expr longPat)
26 , testProperty "Literal test" $ prop_parse_print literal
27 , testProperty "Pattern test" $ prop_parse_print Pat.expr
28 , testProperty "Type test" $ prop_parse_print Type.expr
32 -- This test was autogenerated from the Pattern test and should be
33 -- left in all its ugly glory.
34 longPat = Pat.PData "I" [ Pat.PLiteral (Lit.Chr '+')
36 "q7yclkcm7k_ikstrczv_"
38 ,"c9'eFfhk9FTvsMnwF_D"
46 ,"o2KiCX5'ZRzHJfRi8" ]
47 , Pat.PVar "su'BrrbPUK6I33Eq" ]
49prop_parse_print :: (Pretty a, Arbitrary a, Eq a) => IParser a -> a -> Bool
51 either (const False) (== x) . parse_print p $ x
53parse_print :: (Pretty a) => IParser a -> a -> Either String a
54parse_print p = either (Left . show) (Right) . iParse (p <* eof) . P.renderStyle P.style {mode=P.LeftMode} . pretty
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list