on master help sign in
Use === more widely in tests
3a9970fBryan O'Sullivan
tests/Tests/Properties.hs+17−17
@@ -62,10 +62,10 @@ t_pack_unpack = (T.unpack . T.pack) `eq` id
62tl_pack_unpack = (TL.unpack . TL.pack) `eq` id
62tl_pack_unpack = (TL.unpack . TL.pack) `eq` id
63t_stream_unstream = (S.unstream . S.stream) `eq` id
63t_stream_unstream = (S.unstream . S.stream) `eq` id
64tl_stream_unstream = (SL.unstream . SL.stream) `eq` id
64tl_stream_unstream = (SL.unstream . SL.stream) `eq` id
65−t_reverse_stream t = (S.reverse . S.reverseStream) t == t
65+t_reverse_stream t = (S.reverse . S.reverseStream) t === t
66−t_singleton c = [c] == (T.unpack . T.singleton) c
66+t_singleton c = [c] === (T.unpack . T.singleton) c
67−tl_singleton c = [c] == (TL.unpack . TL.singleton) c
67+tl_singleton c = [c] === (TL.unpack . TL.singleton) c
68−tl_unstreamChunks x = f 11 x == f 1000 x
68+tl_unstreamChunks x = f 11 x === f 1000 x
69 where f n = SL.unstreamChunks n . S.streamList
69 where f n = SL.unstreamChunks n . S.streamList
70tl_chunk_unchunk = (TL.fromChunks . TL.toChunks) `eq` id
70tl_chunk_unchunk = (TL.fromChunks . TL.toChunks) `eq` id
71tl_from_to_strict = (TL.fromStrict . TL.toStrict) `eq` id
71tl_from_to_strict = (TL.fromStrict . TL.toStrict) `eq` id
@@ -76,13 +76,13 @@ encodeL1 = B.pack . map (fromIntegral . fromEnum) . T.unpack
76encodeLazyL1 :: TL.Text -> BL.ByteString
76encodeLazyL1 :: TL.Text -> BL.ByteString
77encodeLazyL1 = BL.fromChunks . map encodeL1 . TL.toChunks
77encodeLazyL1 = BL.fromChunks . map encodeL1 . TL.toChunks
78
78
79−t_ascii t = E.decodeASCII (E.encodeUtf8 a) == a
79+t_ascii t = E.decodeASCII (E.encodeUtf8 a) === a
80 where a = T.map (\c -> chr (ord c `mod` 128)) t
80 where a = T.map (\c -> chr (ord c `mod` 128)) t
81−tl_ascii t = EL.decodeASCII (EL.encodeUtf8 a) == a
81+tl_ascii t = EL.decodeASCII (EL.encodeUtf8 a) === a
82 where a = TL.map (\c -> chr (ord c `mod` 128)) t
82 where a = TL.map (\c -> chr (ord c `mod` 128)) t
83−t_latin1 t = E.decodeLatin1 (encodeL1 a) == a
83+t_latin1 t = E.decodeLatin1 (encodeL1 a) === a
84 where a = T.map (\c -> chr (ord c `mod` 256)) t
84 where a = T.map (\c -> chr (ord c `mod` 256)) t
85−tl_latin1 t = EL.decodeLatin1 (encodeLazyL1 a) == a
85+tl_latin1 t = EL.decodeLatin1 (encodeLazyL1 a) === a
86 where a = TL.map (\c -> chr (ord c `mod` 256)) t
86 where a = TL.map (\c -> chr (ord c `mod` 256)) t
87t_utf8 = forAll genUnicode $ (E.decodeUtf8 . E.encodeUtf8) `eq` id
87t_utf8 = forAll genUnicode $ (E.decodeUtf8 . E.encodeUtf8) `eq` id
88t_utf8' = forAll genUnicode $ (E.decodeUtf8' . E.encodeUtf8) `eq` (id . Right)
88t_utf8' = forAll genUnicode $ (E.decodeUtf8' . E.encodeUtf8) `eq` (id . Right)
@@ -113,7 +113,7 @@ t_utf8_undecoded = forAll genUnicode $ \t ->
113 let b = E.encodeUtf8 t
113 let b = E.encodeUtf8 t
114 ls = concatMap (leftover . E.encodeUtf8 . T.singleton) . T.unpack $ t
114 ls = concatMap (leftover . E.encodeUtf8 . T.singleton) . T.unpack $ t
115 leftover = (++ [B.empty]) . init . tail . B.inits
115 leftover = (++ [B.empty]) . init . tail . B.inits
116− in (map snd . feedChunksOf 1 E.streamDecodeUtf8) b == ls
116+ in (map snd . feedChunksOf 1 E.streamDecodeUtf8) b === ls
117
117
118data Badness = Solo | Leading | Trailing
118data Badness = Solo | Leading | Trailing
119 deriving (Eq, Show)
119 deriving (Eq, Show)
@@ -203,8 +203,8 @@ t_mconcat = unsquare $
203 mconcat `eq` (unpackS . mconcat . L.map T.pack)
203 mconcat `eq` (unpackS . mconcat . L.map T.pack)
204tl_mconcat = unsquare $
204tl_mconcat = unsquare $
205 mconcat `eq` (unpackS . mconcat . L.map TL.pack)
205 mconcat `eq` (unpackS . mconcat . L.map TL.pack)
206−t_mempty = mempty == (unpackS (mempty :: T.Text))
206+t_mempty = mempty === (unpackS (mempty :: T.Text))
207−tl_mempty = mempty == (unpackS (mempty :: TL.Text))
207+tl_mempty = mempty === (unpackS (mempty :: TL.Text))
208t_IsString = fromString `eqP` (T.unpack . fromString)
208t_IsString = fromString `eqP` (T.unpack . fromString)
209tl_IsString = fromString `eqP` (TL.unpack . fromString)
209tl_IsString = fromString `eqP` (TL.unpack . fromString)
210
210
@@ -732,7 +732,7 @@ tl_indices (NotEmpty s) = lazyIndices s `eq` S.indices s
732 conc = T.concat . TL.toChunks
732 conc = T.concat . TL.toChunks
733t_indices_occurs = unsquare $ \(NotEmpty t) ts ->
733t_indices_occurs = unsquare $ \(NotEmpty t) ts ->
734 let s = T.intercalate t ts
734 let s = T.intercalate t ts
735− in Slow.indices t s == indices t s
735+ in Slow.indices t s === indices t s
736
736
737-- Bit shifts.
737-- Bit shifts.
738shiftL w = forAll (choose (0,width-1)) $ \k -> Bits.shiftL w k == U.shiftL w k
738shiftL w = forAll (choose (0,width-1)) $ \k -> Bits.shiftL w k == U.shiftL w k
@@ -824,18 +824,18 @@ tb_formatRealFloat_double (a::Double) = tb_formatRealFloat a
824-- Reading.
824-- Reading.
825
825
826t_decimal (n::Int) s =
826t_decimal (n::Int) s =
827− T.signed T.decimal (T.pack (show n) `T.append` t) == Right (n,t)
827+ T.signed T.decimal (T.pack (show n) `T.append` t) === Right (n,t)
828 where t = T.dropWhile isDigit s
828 where t = T.dropWhile isDigit s
829tl_decimal (n::Int) s =
829tl_decimal (n::Int) s =
830− TL.signed TL.decimal (TL.pack (show n) `TL.append` t) == Right (n,t)
830+ TL.signed TL.decimal (TL.pack (show n) `TL.append` t) === Right (n,t)
831 where t = TL.dropWhile isDigit s
831 where t = TL.dropWhile isDigit s
832t_hexadecimal m s ox =
832t_hexadecimal m s ox =
833− T.hexadecimal (T.concat [p, T.pack (showHex n ""), t]) == Right (n,t)
833+ T.hexadecimal (T.concat [p, T.pack (showHex n ""), t]) === Right (n,t)
834 where t = T.dropWhile isHexDigit s
834 where t = T.dropWhile isHexDigit s
835 p = if ox then "0x" else ""
835 p = if ox then "0x" else ""
836 n = getPositive m :: Int
836 n = getPositive m :: Int
837tl_hexadecimal m s ox =
837tl_hexadecimal m s ox =
838− TL.hexadecimal (TL.concat [p, TL.pack (showHex n ""), t]) == Right (n,t)
838+ TL.hexadecimal (TL.concat [p, TL.pack (showHex n ""), t]) === Right (n,t)
839 where t = TL.dropWhile isHexDigit s
839 where t = TL.dropWhile isHexDigit s
840 p = if ox then "0x" else ""
840 p = if ox then "0x" else ""
841 n = getPositive m :: Int
841 n = getPositive m :: Int
@@ -883,7 +883,7 @@ t_take_drop_16 m t = T.append (takeWord16 n t) (dropWord16 n t) === t
883 where n = small m
883 where n = small m
884t_use_from t = monadicIO $ assert . (==t) =<< run (useAsPtr t fromPtr)
884t_use_from t = monadicIO $ assert . (==t) =<< run (useAsPtr t fromPtr)
885
885
886−t_copy t = T.copy t == t
886+t_copy t = T.copy t === t
887
887
888-- Regression tests.
888-- Regression tests.
889s_filter_eq s = S.filter p t == S.streamList (filter p s)
889s_filter_eq s = S.filter p t == S.streamList (filter p s)