@@ -6,6 +6,7 @@ import Text.Show.Functions
66
77import Data.Char
88import Data.Monoid
9+import Data.String
910import Debug.Trace
1011import Text.Printf
1112import System.Environment
@@ -15,7 +16,7 @@ import Control.Monad
1516import Data.Word
1617import qualified Data.ByteString as B
1718import qualified Data.Text as T
18−import qualified Data.Text.Compat as T (breakSubstring)
19+import qualified Data.Text.Compat as C
1920import qualified Data.Text.Lazy as TL
2021import qualified Data.Text.Encoding as E
2122import Control.Exception
@@ -142,6 +143,8 @@ prop_T_mappend s = mappend s`eqP` (unpackS . mappend (T.pack s))
142143prop_TL_mappend s = mappend s`eqP` (unpackS . mappend (TL.pack s))
143144prop_T_mconcat = mconcat `eq` (unpackS . mconcat . L.map T.pack)
144145prop_TL_mconcat = mconcat `eq` (unpackS . mconcat . L.map TL.pack)
146+prop_T_IsString = fromString `eqP` (T.unpack . fromString)
147+prop_TL_IsString = fromString `eqP` (TL.unpack . fromString)
145148
146149prop_S_cons x = (x:) `eqP` (unpackS . S.cons x)
147150prop_T_cons x = (x:) `eqP` (unpackS . T.cons x)
@@ -332,6 +335,7 @@ prop_TL_split_i c = id `eq` (TL.intercalate (TL.singleton c) . TL.split c)
332335prop_T_splitWith p = splitWith p `eqP` (map unpackS . T.splitWith p)
333336prop_T_splitWith_count c = (L.length . T.splitWith (==c)) `eq` ((1+) . T.count c)
334337prop_T_splitWith_split c = T.splitWith (==c) `eq` T.split (T.singleton c)
338+prop_T_splitWith_Csplit c = T.splitWith (==c) `eq` C.split c
335339prop_TL_splitWith p = splitWith p `eqP` (map unpackS . TL.splitWith p)
336340
337341splitWith :: (a -> Bool) -> [a] -> [[a]]
@@ -350,10 +354,10 @@ prop_T_chunksOf_length k t = len == T.length t || (k <= 0 && len == 0)
350354
351355prop_T_breakSubstring_isInfixOf s l
352356 = T.isInfixOf s l ==
353− T.null s || (not . T.null . snd $ T.breakSubstring s l)
357+ T.null s || (not . T.null . snd $ C.breakSubstring s l)
354358prop_T_breakSubstringC c
355359 = L.break (==c) `eqP`
356− (unpack2 . T.breakSubstring (T.singleton c))
360+ (unpack2 . C.breakSubstring (T.singleton c))
357361
358362prop_T_lines = L.lines `eqP` (map unpackS . T.lines)
359363prop_TL_lines = L.lines `eqP` (map unpackS . TL.lines)
@@ -472,6 +476,8 @@ tests = [
472476 ("prop_TL_mappend", mytest prop_TL_mappend),
473477 ("prop_T_mconcat", mytest prop_T_mconcat),
474478 ("prop_TL_mconcat", mytest prop_TL_mconcat),
479+ ("prop_T_IsString", mytest prop_T_IsString),
480+ ("prop_TL_IsString", mytest prop_TL_IsString),
475481
476482 ("prop_S_cons", mytest prop_S_cons),
477483 ("prop_T_cons", mytest prop_T_cons),
@@ -613,6 +619,7 @@ tests = [
613619 ("prop_T_splitWith", mytest prop_T_splitWith),
614620 ("prop_T_splitWith_count", mytest prop_T_splitWith_count),
615621 ("prop_T_splitWith_split", mytest prop_T_splitWith_split),
622+ ("prop_T_splitWith_Csplit", mytest prop_T_splitWith_Csplit),
616623 ("prop_TL_splitWith", mytest prop_TL_splitWith),
617624 ("prop_T_chunksOf_same_lengths", mytest prop_T_chunksOf_same_lengths),
618625 ("prop_T_chunksOf_length", mytest prop_T_chunksOf_length),