Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 7251c1c

Browse files
robrixpatrickt
andcommitted
Generate empty source values 20% of the time.
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
1 parent b658804 commit 7251c1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/Generators.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ import qualified Data.Source
99
import Data.Functor.Identity
1010

1111
source :: (GenBase m ~ Identity, MonadGen m) => Hedgehog.Range Int -> m Data.Source.Source
12-
source r = Data.Source.fromUTF8 <$> Gen.utf8 r (Gen.frequency [ (1, pure '\r'), (1, pure '\n'), (20, Gen.unicode) ])
12+
source r = Gen.frequency [ (1, empty), (20, nonEmpty) ]
13+
where empty = pure mempty
14+
nonEmpty = Data.Source.fromUTF8 <$> Gen.utf8 r (Gen.frequency [ (1, pure '\r'), (1, pure '\n'), (20, Gen.unicode) ])

0 commit comments

Comments
 (0)