update jinja2 per CVE-2024-34064
[cabal.git] / Cabal-tests / tests / UnitTests / Distribution / Utils / ShortText.hs
blob73298f361de65c4dc351942c57593afaf3f159fb
1 module UnitTests.Distribution.Utils.ShortText
2 ( tests
3 ) where
5 import Data.Monoid as Mon
6 import Test.Tasty
7 import Test.Tasty.QuickCheck
9 import Distribution.Compat.Binary (encode, decode)
11 import Distribution.Utils.ShortText
13 prop_ShortTextOrd :: String -> String -> Bool
14 prop_ShortTextOrd a b = compare a b == compare (toShortText a) (toShortText b)
16 prop_ShortTextMonoid :: String -> String -> Bool
17 prop_ShortTextMonoid a b = Mon.mappend a b == fromShortText (mappend (toShortText a) (toShortText b))
19 prop_ShortTextId :: String -> Bool
20 prop_ShortTextId a = (fromShortText . toShortText) a == a
22 prop_ShortTextBinaryId :: String -> Bool
23 prop_ShortTextBinaryId a = (decode . encode) a' == a'
24 where
25 a' = toShortText a
27 tests :: [TestTree]
28 tests =
29 [ testProperty "ShortText Id" prop_ShortTextId
30 , testProperty "ShortText Ord" prop_ShortTextOrd
31 , testProperty "ShortText Monoid" prop_ShortTextMonoid
32 , testProperty "ShortText BinaryId" prop_ShortTextBinaryId