
Folks,
I'm trying to figure out how to test a Parsec-based parser with Smallcheck [1]. My test AST is below and the goal is to return StyleValue <Int here> if the parser is fed an integer, or return Solid when parsing "Solid", etc.
data Style = StyleValue Expr | Solid | Dashed | Dotted | Dashed2 | Dashed3 deriving Show I'd use QuickCheck rather than SmallCheck. First write Arbitrary instances for Style and Expr (plus obviously any other types used by Expr). Then write another generator that converts a Style to a string with random formatting (whitespace, comments etc). Then assert that the
On Tue, 3 Apr 2007 16:01:56 +0100
Joel Reymont