@@ -19,8 +19,9 @@ import Parse.Parser
20import Debug.Trace
20import Debug.Trace
22−import Util.Stringable
22+import Util.Arbs
23import Util.CharGens
23import Util.CharGens
24+import Util.Stringable
26main :: IO ()
27main :: IO ()
@@ -37,45 +38,6 @@ tests = [
41−newtype ValidIdent = ValidIdent String deriving (Eq, Show)
43−instance Stringable ValidIdent where
44− stringify (ValidIdent v) = v
46−instance Arbitrary ValidIdent where
47− arbitrary = ValidIdent <$> ((:) <$> lowerAlpha <*> (listOf alphaNumUnderPrime))
50−newtype StringValue = StringValue String deriving (Eq, Show)
52−instance Stringable StringValue where
53− stringify (StringValue v) = v
55−instance Arbitrary StringValue where
56− arbitrary = StringValue <$> escape <$> arbitrary
59−newtype InvalidIdentChar = InvalidIdentChar Char deriving (Eq, Show)
61−instance Stringable InvalidIdentChar where
62− stringify (InvalidIdentChar c) = [c]
64−instance Arbitrary InvalidIdentChar where
65− arbitrary = InvalidIdentChar <$> elements "!@#$%^&*()-=+\\|/?.>,<`~"
68−replace' :: String -> String -> String -> String
69−replace' a b c = unpack $ replace (pack a) (pack b) (pack c)
71−escape :: String -> String
73− (replace' "\n" "\\n") .
74− (replace' "\t" "\\t") .
75− (replace' "\"" "\\\"") .
76− (replace' "\\" "\\\\")
79-- TODO: variable whitespace?
41-- TODO: variable whitespace?
80prop_assignString :: ValidIdent -> StringValue -> Bool
42prop_assignString :: ValidIdent -> StringValue -> Bool
81prop_assignString vi sv =
43prop_assignString vi sv =