Reimplement `cabal check` (#8427)
[cabal.git] / cabal-testsuite / PackageTests / CaretOperator / setup.test.hs
blobdb7621a77d0565c00c3ec1b25f71c9e483b41043
1 import Test.Cabal.Prelude
3 import Control.Monad
4 import Distribution.Version
5 import Distribution.Simple.LocalBuildInfo
6 import Distribution.Package
7 import Distribution.Types.Dependency
8 import Distribution.PackageDescription
9 import Language.Haskell.Extension (Language(..))
10 import Distribution.Utils.Path
12 -- Test that setup parses '^>=' operator correctly.
13 -- Don't bother with the cabal-install test as the build-depends
14 -- is updated by this point so that we lost the caret parsing.
15 main = setupTest $ do
16 -- Don't run this for GHC 7.0/7.2, which doesn't have a recent
17 -- enough version of pretty. (But this is pretty dumb.)
18 skipUnlessGhcVersion ">= 7.3"
19 assertOutputDoesNotContain "Parse of field 'build-depends' failed"
20 =<< setup' "configure" []
21 lbi <- getLocalBuildInfoM
23 let Just gotLib = library (localPkgDescr lbi)
24 bi = libBuildInfo gotLib
25 assertEqual "defaultLanguage" (Just Haskell2010) (defaultLanguage bi)
26 forM_ (targetBuildDepends bi) $ \(Dependency pn vr _) ->
27 when (pn == mkPackageName "pretty") $
28 assertEqual "targetBuildDepends/pretty"
29 vr (majorBoundVersion (mkVersion [1,1,1,0]))
30 assertEqual "hsSourceDirs" [sameDirectory] (hsSourceDirs bi)
31 return ()