Skip to content

Commit

Permalink
Fixed tests for ICU < 72 (fixes #94 once again)
Browse files Browse the repository at this point in the history
  • Loading branch information
vshabanov committed Oct 4, 2023
1 parent ae890ee commit 5f9e987
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.8.0.4

* Fixed tests to work with ICU < 72 (#94)

0.8.0.3

* Support for ICU 72 (#94)
Expand Down
16 changes: 13 additions & 3 deletions tests/Properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module Properties (propertyTests, testCases) where

import Control.Monad (unless)
import qualified Control.Exception as E
import Control.DeepSeq (NFData(..))
import Data.Function (on)
import Data.Maybe (fromMaybe)
Expand All @@ -23,6 +25,7 @@ import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.Framework.Providers.HUnit (hUnitTestToTests)
import Test.HUnit ((~?=), (@?=), (~:))
import qualified Test.HUnit (Test(..), assertFailure)
import Test.HUnit.Lang (HUnitFailure (..), FailureReason (..))
import Test.QuickCheck.Monadic (monadicIO, run, assert)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
Expand Down Expand Up @@ -172,8 +175,12 @@ testCases =
,(I.unfold I.group <$> I.findAll "[abc]+" "xx b yy ac") ~?= [["b"],["ac"]]
,I.toUpper (Locale "de-DE") "ß" ~?= "SS"
,I.toCaseFold False "flag" ~?= "flag"
,map I.blockCode ['\x1FA50', '\203257', '\73494'] ~?=
[I.ChessSymbols, I.CjkUnifiedIdeographsExtensionH, I.Kawi]
,map I.blockCode ['\x1FA50', '\203257', '\73494']
`oneOf`
[[I.ChessSymbols, I.CjkUnifiedIdeographsExtensionH, I.Kawi]
,[I.ChessSymbols, I.NoBlock, I.NoBlock]
-- ICU < 72 does not have last two codes
]
,I.direction '\x2068' ~?= I.FirstStrongIsolate
,I.getSkeleton I.spoof Nothing "\1089\1072t" ~?= "cat"
,S.shapeArabic [S.LettersShape] (nosp "ا ب ت ث") ~?= (nosp "ﺍ ﺑ ﺘ ﺚ")
Expand Down Expand Up @@ -236,7 +243,10 @@ testCases =
ioEq io a = Test.HUnit.TestCase $ do
x <- io
x @?= a

oneOf actual expected = Test.HUnit.TestCase $
unless (actual `elem` expected) $
E.throwIO $ HUnitFailure Nothing $ ExpectedButGot Nothing
(unlines $ "one of:" : map show expected) (show actual)

testCases_collate :: Test.HUnit.Test
testCases_collate = Test.HUnit.TestList $
Expand Down
2 changes: 1 addition & 1 deletion text-icu.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cabal-version: 1.18
-- 1.18 introduced extra-doc-files
name: text-icu
version: 0.8.0.3
version: 0.8.0.4
synopsis: Bindings to the ICU library
homepage: https://github.com/haskell/text-icu
bug-reports: https://github.com/haskell/text-icu/issues
Expand Down

0 comments on commit 5f9e987

Please sign in to comment.