on master help sign in
Fix Unicode-version-dependent bug in new toTitle test
commit831626dcc7a779ccdff6866bbb7d22326950e0eb authorBryan O'Sullivan <bos@serpentine.com> dateWed 7 Dec 2016, 04:42 (10 years ago) parent06cae1e
1 file changed+5−1
tests/Tests/Properties.hs+5−1
tests/Tests/Properties.hs+5−1
@@ -329,8 +329,12 @@ tl_toUpper_upper t = p (TL.toUpper t) >= p t
329329 where p = TL.length . TL.filter isUpper
330330t_toTitle_title t = all (<= 1) (caps t)
331331 where caps = fmap (T.length . T.filter isUpper) . T.words . T.toTitle
332−t_toTitle_1stNotLower = all id . (notLow . T.toTitle)
332+t_toTitle_1stNotLower = and . notLow . T.toTitle . T.filter stable
333333 where notLow = mapMaybe (fmap (not . isLower) . (T.find isLetter)) . T.words
334+ -- Surprise! The Spanish/Portuguese ordinal indicators changed
335+ -- from category Ll (letter, lowercase) to Lo (letter, other)
336+ -- in Unicode 7.0
337+ stable c = c /= '\170' && c /= '\186'
334338
335339justifyLeft k c xs = xs ++ L.replicate (k - length xs) c
336340justifyRight m n xs = L.replicate (m - length xs) n ++ xs