~jojo/Carth

ref: 0ca6854f36d83bfe5c58e75b48afa968edb7c662 Carth/test/ParseSpec.hs -rw-r--r-- 444 bytes
0ca6854fJoJo Disallow arbitrary constructors of reserved names like "Fun" 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE NumDecimals #-}

module ParseSpec where

import Text.Parsec hiding (parse)
import Test.Hspec
import Test.QuickCheck

import Misc
import Ast
import Parse

spec :: Spec
spec = do
    describe "parse inverse of pretty"
        $ it
              "Parsing a pretty printed program should return the original program"
        $ withMaxSuccess
              4e5
              (\progAst -> parse "spec" (pretty progAst) == Right progAst)