From 5890f8c461e266a04487c197843b1b574a1c203d Mon Sep 17 00:00:00 2001 From: Sean D Gillespie Date: Sun, 17 Mar 2024 22:19:34 -0400 Subject: [PATCH] refactor(test): Reduce some duplication --- test/Data/Gibberish/Gen/PassSpec.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/Data/Gibberish/Gen/PassSpec.hs b/test/Data/Gibberish/Gen/PassSpec.hs index eb82755..b4325b0 100644 --- a/test/Data/Gibberish/Gen/PassSpec.hs +++ b/test/Data/Gibberish/Gen/PassSpec.hs @@ -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) @@ -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 @@ -285,3 +281,6 @@ spec = do assert $ not (null phrase) && all (isInRange . unWord) phrase + +shouldHaveLength :: Word -> Int -> Bool +shouldHaveLength (Word w) = (Text.length w ==)