Add “Ignore warning” option to cabal check
[cabal.git] / Cabal-tests / tests / UnitTests / Distribution / PackageDescription / Check.hs
blob2665b49a6de33d20aa8a4b0300ce3a0bb4bd3d58
1 module UnitTests.Distribution.PackageDescription.Check (tests) where
3 import Distribution.Compat.Prelude.Internal
4 import Prelude ()
6 import Distribution.PackageDescription.Check
8 import Test.Tasty
9 import Test.Tasty.HUnit
11 -- instances
12 import Test.QuickCheck.Instances.Cabal ()
15 tests :: [TestTree]
16 tests =
17 [ testCase "Unique ignore strings" (uniqueNames @?= True)
18 , testCase "Short ignore identifiers" (longerThan @?= [])
19 , testCase "Parsimonious '-' use" (usingTooManyDashes @?= [])
21 where
22 allExplanationIdStrings :: [CheckExplanationIDString]
23 allExplanationIdStrings = map ppCheckExplanationId [minBound..maxBound]
25 uniqueNames :: Bool
26 uniqueNames = length allExplanationIdStrings == length (nub allExplanationIdStrings)
28 longerThan :: [CheckExplanationIDString]
29 longerThan = filter ((>25). length) allExplanationIdStrings
31 usingTooManyDashes :: [CheckExplanationIDString]
32 usingTooManyDashes = filter ((>2) . length . filter (=='-'))
33 allExplanationIdStrings