Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests compatible with QuickCheck 2.10 #148

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Make tests compatible with QuickCheck 2.10
The instance `Arbitrary Char` covers all unicode since QuickCheck 2.10
Lysxia committed Jan 10, 2019
commit 7fb023a95d110d36e720114d9f6cfb989d4e1b71
2 changes: 1 addition & 1 deletion attoparsec.cabal
Original file line number Diff line number Diff line change
@@ -127,7 +127,7 @@ test-suite tests
base >= 4 && < 5,
bytestring,
deepseq >= 1.1,
QuickCheck >= 2.7 && < 2.10,
QuickCheck >= 2.7 && < 2.13,
quickcheck-unicode,
scientific,
tasty >= 0.11,
8 changes: 4 additions & 4 deletions tests/QC/ByteString.hs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ module QC.ByteString (tests) where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<*>), (<$>))
#endif
import Data.Char (chr, ord, toUpper)
import Data.Char (toUpper)
import Data.Int (Int64)
import Data.Word (Word8)
import Prelude hiding (take, takeWhile)
@@ -26,9 +26,9 @@ import qualified Data.ByteString.Lazy.Char8 as L8
satisfy :: Word8 -> L.ByteString -> Property
satisfy w s = parseBS (P.satisfy (<=w)) (L.cons w s) === Just w

satisfyWith :: Char -> L.ByteString -> Property
satisfyWith c s = parseBS (P.satisfyWith (chr . fromIntegral) (<=c))
(L.cons (fromIntegral (ord c)) s) === Just c
satisfyWith :: Word8 -> L.ByteString -> Property
satisfyWith c s = parseBS (P.satisfyWith fromIntegral (<=c))
(L.cons (fromIntegral c) s) === Just c

word8 :: Word8 -> L.ByteString -> Property
word8 w s = parseBS (P.word8 w) (L.cons w s) === Just w