@@ -2,7 +2,7 @@
2 TypeSynonymInstances #-}
2 TypeSynonymInstances #-}
3{-# OPTIONS_GHC -fno-enable-rewrite-rules #-}
3{-# OPTIONS_GHC -fno-enable-rewrite-rules #-}
5−import Test.QuickCheck
5+import Test.QuickCheck hiding (evaluate)
6import Text.Show.Functions ()
6import Text.Show.Functions ()
8import qualified Data.Bits as Bits (shiftL, shiftR)
8import qualified Data.Bits as Bits (shiftL, shiftR)
@@ -15,7 +15,7 @@ import Data.Word (Word8, Word16, Word32)
15import qualified Data.Text as T
15import qualified Data.Text as T
16import qualified Data.Text.Lazy as TL
16import qualified Data.Text.Lazy as TL
17import qualified Data.Text.Encoding as E
17import qualified Data.Text.Encoding as E
18−import Control.Exception (SomeException, try)
18+import Control.Exception (SomeException, evaluate, try)
19import qualified Data.Text.Fusion as S
19import qualified Data.Text.Fusion as S
20import qualified Data.Text.Fusion.Common as S
20import qualified Data.Text.Fusion.Common as S
21import Data.Text.Fusion.Size
21import Data.Text.Fusion.Size
@@ -38,8 +38,8 @@ import QuickCheckUtils (NotEmpty(..), small)
38(=^=) :: (Eq a, Show a) => a -> a -> Bool
38(=^=) :: (Eq a, Show a) => a -> a -> Bool
39{-# NOINLINE (=^=) #-}
39{-# NOINLINE (=^=) #-}
40i =^= j = unsafePerformIO $ do
40i =^= j = unsafePerformIO $ do
41− x <- try (return $! i)
41+ x <- try (evaluate i)
42− y <- try (return $! j)
42+ y <- try (evaluate j)
43 case (x,y) of
43 case (x,y) of
44 (Left (_ :: SomeException), Left (_ :: SomeException))
44 (Left (_ :: SomeException), Left (_ :: SomeException))
45 -> return True
45 -> return True
@@ -398,7 +398,11 @@ tl_inits = L.inits `eqP` (map unpackS . TL.inits)
398t_tails = L.tails `eqP` (map unpackS . T.tails)
398t_tails = L.tails `eqP` (map unpackS . T.tails)
399tl_tails = L.tails `eqP` (map unpackS . TL.tails)
399tl_tails = L.tails `eqP` (map unpackS . TL.tails)
401+findSplit s t = let (x,xs) = T.find s t
402+ in x : L.map (T.drop (T.length s)) xs
404+t_findSplit s = T.split s `eq` findSplit s
401−t_split_split p = T.split p `eq` Slow.split p
405+t_split_split s = T.split s `eq` Slow.split s
402t_split_i (NotEmpty t) = id `eq` (T.intercalate t . T.split t)
406t_split_i (NotEmpty t) = id `eq` (T.intercalate t . T.split t)
403tl_split_i (NotEmpty t) = id `eq` (TL.intercalate t . TL.split t)
407tl_split_i (NotEmpty t) = id `eq` (TL.intercalate t . TL.split t)
404t_splitTimes_i k (NotEmpty t) = id `eq` (T.intercalate t . T.splitTimes k t)
408t_splitTimes_i k (NotEmpty t) = id `eq` (T.intercalate t . T.splitTimes k t)
@@ -802,6 +806,7 @@ tests = [
804 testGroup "breaking many" [
808 testGroup "breaking many" [
809+ testProperty "t_findSplit" t_findSplit,
805 testProperty "t_split_split" t_split_split,
810 testProperty "t_split_split" t_split_split,
806 testProperty "t_split_i" t_split_i,
811 testProperty "t_split_i" t_split_i,
807 testProperty "t_splitTimes_i" t_splitTimes_i,
812 testProperty "t_splitTimes_i" t_splitTimes_i,