update jinja2 per CVE-2024-34064
[cabal.git] / Cabal-tests / tests / UnitTests / Distribution / PackageDescription / Check.hs
blob662a0684cdab4bbfebc3399aa6f4705aaa428b33
1 -- For the deprecated import of Distribution.Compat.Prelude.Internal
2 {-# OPTIONS_GHC -Wwarn=deprecations #-}
4 module UnitTests.Distribution.PackageDescription.Check (tests) where
6 import Distribution.Compat.Prelude
7 import Prelude ()
9 import Distribution.PackageDescription.Check
11 import Test.Tasty
12 import Test.Tasty.HUnit
14 -- instances
15 import Test.QuickCheck.Instances.Cabal ()
18 tests :: [TestTree]
19 tests =
20 [ testCase "Unique ignore strings" (uniqueNames @?= True)
21 , testCase "Short ignore identifiers" (longerThan @?= [])
22 , testCase "Parsimonious '-' use" (usingTooManyDashes @?= [])
24 where
25 allExplanationIdStrings :: [CheckExplanationIDString]
26 allExplanationIdStrings = map ppCheckExplanationId [minBound..maxBound]
28 uniqueNames :: Bool
29 uniqueNames = length allExplanationIdStrings == length (nub allExplanationIdStrings)
31 longerThan :: [CheckExplanationIDString]
32 longerThan = filter ((>25). length) allExplanationIdStrings
34 usingTooManyDashes :: [CheckExplanationIDString]
35 usingTooManyDashes = filter ((>2) . length . filter (=='-'))
36 allExplanationIdStrings