Skip to content

Commit 9ceaa3f

Browse files
committed
Fix test of title conversion for Georgian characters
1 parent 93c1328 commit 9ceaa3f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

benchmarks/haskell/Benchmarks/Programs/BigTable.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module Benchmarks.Programs.BigTable
1313

1414
import Test.Tasty.Bench (Benchmark, bench, whnfIO)
1515
#if !MIN_VERSION_base(4,8,0)
16-
import Data.Monoid (mconcat, mempty)
16+
import Data.Monoid (mconcat, mempty, mappend)
1717
#endif
1818
import Data.Text.Lazy.Builder (Builder, fromText, toLazyText)
1919
import Data.Text.Lazy.IO (hPutStr)

tests/Tests/Properties/Text.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ t_toTitle_title t = all (<= 1) (caps w)
110110
where caps = fmap (T.length . T.filter isUpper) . T.words . T.toTitle
111111
-- TIL: there exist uppercase-only letters
112112
w = T.filter (\c -> if C.isUpper c then C.toLower c /= c else True) t
113-
t_toTitle_1stNotLower = and . notLow . T.toTitle . T.filter stable
113+
t_toTitle_1stNotLower = and . notLow . T.toTitle . T.filter stable . T.filter (not . isGeorgian)
114114
where notLow = mapMaybe (fmap (not . isLower) . (T.find isLetter)) . T.words
115115
-- Surprise! The Spanish/Portuguese ordinal indicators changed
116116
-- from category Ll (letter, lowercase) to Lo (letter, other)
@@ -119,6 +119,9 @@ t_toTitle_1stNotLower = and . notLow . T.toTitle . T.filter stable
119119
stable c = if isLower c
120120
then C.toUpper c /= c
121121
else c /= '\170' && c /= '\186'
122+
-- Georgian text does not have a concept of title case
123+
-- https://en.wikipedia.org/wiki/Georgian_Extended
124+
isGeorgian c = c >= '\4256' && c < '\4352'
122125

123126
justifyLeft k c xs = xs ++ L.replicate (k - length xs) c
124127
justifyRight m n xs = L.replicate (m - length xs) n ++ xs

0 commit comments

Comments
 (0)