@@ -6,6 +6,7 @@ import Text.Show.Functions
7import Data.Char
7import Data.Char
8import Data.Monoid
8import Data.Monoid
9import Debug.Trace
10import Debug.Trace
10import Text.Printf
11import Text.Printf
11import System.Environment
12import System.Environment
@@ -15,7 +16,7 @@ import Control.Monad
15import Data.Word
16import Data.Word
16import qualified Data.ByteString as B
17import qualified Data.ByteString as B
17import qualified Data.Text as T
18import qualified Data.Text as T
18−import qualified Data.Text.Compat as T (breakSubstring)
19+import qualified Data.Text.Compat as C
19import qualified Data.Text.Lazy as TL
20import qualified Data.Text.Lazy as TL
20import qualified Data.Text.Encoding as E
21import qualified Data.Text.Encoding as E
21import Control.Exception
22import Control.Exception
@@ -142,6 +143,8 @@ prop_T_mappend s = mappend s`eqP` (unpackS . mappend (T.pack s))
142prop_TL_mappend s = mappend s`eqP` (unpackS . mappend (TL.pack s))
143prop_TL_mappend s = mappend s`eqP` (unpackS . mappend (TL.pack s))
143prop_T_mconcat = mconcat `eq` (unpackS . mconcat . L.map T.pack)
144prop_T_mconcat = mconcat `eq` (unpackS . mconcat . L.map T.pack)
144prop_TL_mconcat = mconcat `eq` (unpackS . mconcat . L.map TL.pack)
145prop_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)
146prop_S_cons x = (x:) `eqP` (unpackS . S.cons x)
149prop_S_cons x = (x:) `eqP` (unpackS . S.cons x)
147prop_T_cons x = (x:) `eqP` (unpackS . T.cons x)
150prop_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)
332prop_T_splitWith p = splitWith p `eqP` (map unpackS . T.splitWith p)
335prop_T_splitWith p = splitWith p `eqP` (map unpackS . T.splitWith p)
333prop_T_splitWith_count c = (L.length . T.splitWith (==c)) `eq` ((1+) . T.count c)
336prop_T_splitWith_count c = (L.length . T.splitWith (==c)) `eq` ((1+) . T.count c)
334prop_T_splitWith_split c = T.splitWith (==c) `eq` T.split (T.singleton c)
337prop_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
335prop_TL_splitWith p = splitWith p `eqP` (map unpackS . TL.splitWith p)
339prop_TL_splitWith p = splitWith p `eqP` (map unpackS . TL.splitWith p)
337splitWith :: (a -> Bool) -> [a] -> [[a]]
341splitWith :: (a -> Bool) -> [a] -> [[a]]
@@ -350,10 +354,10 @@ prop_T_chunksOf_length k t = len == T.length t || (k <= 0 && len == 0)
351prop_T_breakSubstring_isInfixOf s l
355prop_T_breakSubstring_isInfixOf s l
352 = T.isInfixOf s l ==
356 = 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)
354prop_T_breakSubstringC c
358prop_T_breakSubstringC c
355 = L.break (==c) `eqP`
359 = L.break (==c) `eqP`
356− (unpack2 . T.breakSubstring (T.singleton c))
360+ (unpack2 . C.breakSubstring (T.singleton c))
358prop_T_lines = L.lines `eqP` (map unpackS . T.lines)
362prop_T_lines = L.lines `eqP` (map unpackS . T.lines)
359prop_TL_lines = L.lines `eqP` (map unpackS . TL.lines)
363prop_TL_lines = L.lines `eqP` (map unpackS . TL.lines)
@@ -472,6 +476,8 @@ tests = [
472 ("prop_TL_mappend", mytest prop_TL_mappend),
476 ("prop_TL_mappend", mytest prop_TL_mappend),
473 ("prop_T_mconcat", mytest prop_T_mconcat),
477 ("prop_T_mconcat", mytest prop_T_mconcat),
474 ("prop_TL_mconcat", mytest prop_TL_mconcat),
478 ("prop_TL_mconcat", mytest prop_TL_mconcat),
479+ ("prop_T_IsString", mytest prop_T_IsString),
480+ ("prop_TL_IsString", mytest prop_TL_IsString),
476 ("prop_S_cons", mytest prop_S_cons),
482 ("prop_S_cons", mytest prop_S_cons),
477 ("prop_T_cons", mytest prop_T_cons),
483 ("prop_T_cons", mytest prop_T_cons),
@@ -613,6 +619,7 @@ tests = [
613 ("prop_T_splitWith", mytest prop_T_splitWith),
619 ("prop_T_splitWith", mytest prop_T_splitWith),
614 ("prop_T_splitWith_count", mytest prop_T_splitWith_count),
620 ("prop_T_splitWith_count", mytest prop_T_splitWith_count),
615 ("prop_T_splitWith_split", mytest prop_T_splitWith_split),
621 ("prop_T_splitWith_split", mytest prop_T_splitWith_split),
622+ ("prop_T_splitWith_Csplit", mytest prop_T_splitWith_Csplit),
616 ("prop_TL_splitWith", mytest prop_TL_splitWith),
623 ("prop_TL_splitWith", mytest prop_TL_splitWith),
617 ("prop_T_chunksOf_same_lengths", mytest prop_T_chunksOf_same_lengths),
624 ("prop_T_chunksOf_same_lengths", mytest prop_T_chunksOf_same_lengths),
618 ("prop_T_chunksOf_length", mytest prop_T_chunksOf_length),
625 ("prop_T_chunksOf_length", mytest prop_T_chunksOf_length),