Skip to content

Commit

Permalink
refactor(test): Reduce some duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillespie committed Mar 18, 2024
1 parent 3df3473 commit 5890f8c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/Data/Gibberish/Gen/PassSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ spec = do

listSize <- forAll $ Gen.int (Range.linear 1 50)

let shouldHaveLength (Word w) = (Text.length w ==)

assert $
not (null passes)
&& all (`shouldHaveLength` woptsLength opts') (take listSize passes)
Expand All @@ -214,8 +212,6 @@ spec = do
(passes, _) <- liftIO $ usingPassT randomGen (genPasswords' opts' numberWords)
annotateShow passes

let shouldHaveLength (Word w) = (Text.length w ==)

assert $
not (null passes)
&& all (`shouldHaveLength` woptsLength opts') passes
Expand Down Expand Up @@ -285,3 +281,6 @@ spec = do

assert $
not (null phrase) && all (isInRange . unWord) phrase

shouldHaveLength :: Word -> Int -> Bool
shouldHaveLength (Word w) = (Text.length w ==)

0 comments on commit 5890f8c

Please sign in to comment.