Skip to content

Commit

Permalink
Limit the size of QuickCheck-generated patterns.
Browse files Browse the repository at this point in the history
See #259.
  • Loading branch information
quasicomputational committed Mar 27, 2020
1 parent 9206263 commit 3a0a3b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doctest.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 3d7f2d7e8e9004ee6c85c07fd6ad6a650c1d0339af9e4277127949ce36409596
-- hash: 53ffc034338153cc76d198a3ba3f05173f47d8bfe1c186f319401ec35e58446a

name: doctest
version: 0.16.2
Expand Down Expand Up @@ -241,6 +241,7 @@ test-suite spec
, ghc >=7.0 && <8.11
, ghc-paths >=0.1.0.9
, hspec >=2.3.0
, hspec-core >=2.3.0
, mockery
, process
, setenv
Expand Down
1 change: 1 addition & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ tests:
dependencies:
- HUnit
- hspec >= 2.3.0
- hspec-core >= 2.3.0
- QuickCheck >= 2.13.1
- stringbuilder >= 0.4
- silently >= 1.2.4
Expand Down
9 changes: 6 additions & 3 deletions test/Runner/ExampleSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Prelude.Compat

import Data.String
import Test.Hspec
import Test.Hspec.Core.QuickCheck (modifyMaxSize)
import Test.QuickCheck

import Parse
Expand Down Expand Up @@ -59,9 +60,11 @@ spec = do
mkResult ["foo", WildCardLine, "bar"] ["foo", "baz", "bazoom", "bar"]
`shouldBe` Equal

it "matches an arbitrary number of lines (quickcheck)" $ do
property $ \xs -> mkResult (lineToExpected xs) (lineToActual xs)
`shouldBe` Equal
-- See https://github.com/sol/doctest/issues/259
modifyMaxSize (const 8) $
it "matches an arbitrary number of lines (quickcheck)" $ do
property $ \xs -> mkResult (lineToExpected xs) (lineToActual xs)
`shouldBe` Equal

context "with WildCardChunk" $ do
it "matches an arbitrary line chunk" $ do
Expand Down

0 comments on commit 3a0a3b2

Please sign in to comment.