@@ -2,7 +2,7 @@
22 TypeSynonymInstances #-}
33{-# OPTIONS_GHC -fno-enable-rewrite-rules #-}
44
5−import Test.QuickCheck
5+import Test.QuickCheck hiding (evaluate)
66import Text.Show.Functions ()
77
88import qualified Data.Bits as Bits (shiftL, shiftR)
@@ -15,7 +15,7 @@ import Data.Word (Word8, Word16, Word32)
1515import qualified Data.Text as T
1616import qualified Data.Text.Lazy as TL
1717import qualified Data.Text.Encoding as E
18−import Control.Exception (SomeException, try)
18+import Control.Exception (SomeException, evaluate, try)
1919import qualified Data.Text.Fusion as S
2020import qualified Data.Text.Fusion.Common as S
2121import Data.Text.Fusion.Size
@@ -38,8 +38,8 @@ import QuickCheckUtils (NotEmpty(..), small)
3838(=^=) :: (Eq a, Show a) => a -> a -> Bool
3939{-# NOINLINE (=^=) #-}
4040i =^= j = unsafePerformIO $ do
41− x <- try (return $! i)
42− y <- try (return $! j)
41+ x <- try (evaluate i)
42+ y <- try (evaluate j)
4343 case (x,y) of
4444 (Left (_ :: SomeException), Left (_ :: SomeException))
4545 -> return True
@@ -398,7 +398,11 @@ tl_inits = L.inits `eqP` (map unpackS . TL.inits)
398398t_tails = L.tails `eqP` (map unpackS . T.tails)
399399tl_tails = L.tails `eqP` (map unpackS . TL.tails)
400400
401−t_split_split p = T.split p `eq` Slow.split p
401+findSplit s t = let (x,xs) = T.find s t
402+ in x : L.map (T.drop (T.length s)) xs
403+
404+t_findSplit s = T.split s `eq` findSplit s
405+t_split_split s = T.split s `eq` Slow.split s
402406t_split_i (NotEmpty t) = id `eq` (T.intercalate t . T.split t)
403407tl_split_i (NotEmpty t) = id `eq` (TL.intercalate t . TL.split t)
404408t_splitTimes_i k (NotEmpty t) = id `eq` (T.intercalate t . T.splitTimes k t)
@@ -802,6 +806,7 @@ tests = [
802806 ],
803807
804808 testGroup "breaking many" [
809+ testProperty "t_findSplit" t_findSplit,
805810 testProperty "t_split_split" t_split_split,
806811 testProperty "t_split_i" t_split_i,
807812 testProperty "t_splitTimes_i" t_splitTimes_i,