on master help sign in
Cover justifyLeft on streams.

--HG-- extra : convert_revision : d915912853c11c1974ffe8faee3c72da736ea7a4

commitd06b92bf56009346d472bb1b5c1a6eb9576decac authorBryan O'Sullivan <bos@serpentine.com> dateFri 14 Aug 2009, 23:06 (17 years ago) parenteab0a1d
2 files changed+6−3
Data/Text.hs+1−1 tests/Properties.hs+5−2
Data/Text.hs+1−1
@@ -290,7 +290,7 @@ uncons t@(Text arr off len)
290290 | len <= 0 = Nothing
291291 | otherwise = Just (c, textP arr (off+d) (len-d))
292292 where (c,d) = iter t 0
293−{-# INLINE uncons #-}
293+{-# INLINE [1] uncons #-}
294294
295295-- | Lifted from Control.Arrow and specialized.
296296second :: (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
212212prop_T_toUpper_upper t = p (T.toUpper t) >= p t
213213 where p = T.length . T.filter isUpper
214214
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)
217219prop_T_justifyRight k c = jr k c `eqP` (unpackS . T.justifyRight k c)
218220 where jr k c s = replicate (k - length s) c ++ s
219221
@@ -519,6 +521,7 @@ tests = [
519521 ("prop_T_toUpper_length", mytest prop_T_toUpper_length),
520522 ("prop_T_toUpper_upper", mytest prop_T_toUpper_upper),
521523
524+ ("prop_S_justifyLeft", mytest prop_S_justifyLeft),
522525 ("prop_T_justifyLeft", mytest prop_T_justifyLeft),
523526 ("prop_T_justifyRight", mytest prop_T_justifyRight),
524527