quickcheck-string-random-0.1.1.0: Helper to build generators with Text.StringRandom

CopyrightCopyright (C) 2016- hiratara
LicenseGPL-3
Maintainerhiratara@cpan.org
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Test.QuickCheck.StringRandom

Description

A text generator that generates a string that matches a regular expression.

    
    import qualified Test.QuickCheck as QC
    import Test.QuickCheck.StringRandom (matchRegexp)

    prop_generateDigit :: QC.Property
    prop_generateDigit = QC.forAll (matchRegexp "\d") $ digit -> ...

    -- or

    newtype Upper = Upper Text.Text deriving (Eq, Show)

    instance QC.Arbitrary Upper where
      arbitrary = Upper $ matchRegexp "[A-Z]"

    prop_generateUpper :: Upper -> Bool
    prop_generateUpper (Upper upper) = ...

The shrink function has not been defined yet.

Synopsis

Documentation

matchRegexp :: Text -> Gen Text Source #

The 'matchRegexp pat' defines a generator that produces a text that | matches a regular expression pat