on master help sign in
Cover justifyLeft on streams.
d06b92bBryan O'Sullivan
Data/Text.hs+1−1
@@ -290,7 +290,7 @@ uncons t@(Text arr off len)
290 | len <= 0 = Nothing
290 | len <= 0 = Nothing
291 | otherwise = Just (c, textP arr (off+d) (len-d))
291 | otherwise = Just (c, textP arr (off+d) (len-d))
292 where (c,d) = iter t 0
292 where (c,d) = iter t 0
293−{-# INLINE uncons #-}
293+{-# INLINE [1] uncons #-}
294
294
295-- | Lifted from Control.Arrow and specialized.
295-- | Lifted from Control.Arrow and specialized.
296second :: (b -> c) -> (a,b) -> (a,c)
296second :: (b -> c) -> (a,b) -> (a,c)
tests/Properties.hs+5−2
@@ -212,8 +212,10 @@ prop_T_toUpper_length t = T.length (T.toUpper t) >= T.length t
212prop_T_toUpper_upper t = p (T.toUpper t) >= p t
212prop_T_toUpper_upper t = p (T.toUpper t) >= p t
213 where p = T.length . T.filter isUpper
213 where p = T.length . T.filter isUpper
214
214
215−prop_T_justifyLeft k c = jl k c `eqP` (unpackS . T.justifyLeft k c)
216− where jl k c s = s ++ replicate (k - length s) c
215+justifyLeft k c s = s ++ replicate (k - length s) c
216+
217+prop_S_justifyLeft k c = justifyLeft k c `eqP` (unpackS . S.justifyLeft k c)
218+prop_T_justifyLeft k c = justifyLeft k c `eqP` (unpackS . T.justifyLeft k c)
217prop_T_justifyRight k c = jr k c `eqP` (unpackS . T.justifyRight k c)
219prop_T_justifyRight k c = jr k c `eqP` (unpackS . T.justifyRight k c)
218 where jr k c s = replicate (k - length s) c ++ s
220 where jr k c s = replicate (k - length s) c ++ s
219
221
@@ -519,6 +521,7 @@ tests = [
519 ("prop_T_toUpper_length", mytest prop_T_toUpper_length),
521 ("prop_T_toUpper_length", mytest prop_T_toUpper_length),
520 ("prop_T_toUpper_upper", mytest prop_T_toUpper_upper),
522 ("prop_T_toUpper_upper", mytest prop_T_toUpper_upper),
521
523
524+ ("prop_S_justifyLeft", mytest prop_S_justifyLeft),
522 ("prop_T_justifyLeft", mytest prop_T_justifyLeft),
525 ("prop_T_justifyLeft", mytest prop_T_justifyLeft),
523 ("prop_T_justifyRight", mytest prop_T_justifyRight),
526 ("prop_T_justifyRight", mytest prop_T_justifyRight),
524
527