ghc-mod/test/CabalApiSpec.hs

19 lines
1.4 KiB
Haskell
Raw Normal View History

2013-02-12 07:24:33 +00:00
module CabalApiSpec where
2013-03-01 03:21:42 +00:00
import Control.Applicative
2013-02-12 07:24:33 +00:00
import Test.Hspec
import CabalApi
spec :: Spec
spec = do
2013-03-01 06:25:43 +00:00
describe "cabalAllDependPackages" $ do
2013-02-12 07:24:33 +00:00
it "extracts dependent packages" $ do
2013-03-01 06:25:43 +00:00
pkgs <- cabalAllDependPackages <$> cabalParseFile "test/data/cabalapi.cabal"
2013-03-13 03:48:26 +00:00
pkgs `shouldBe` ["Cabal","base","template-haskell"]
2013-02-12 07:24:33 +00:00
describe "cabalBuildInfo" $ do
it "extracts build info" $ do
2013-03-01 04:14:46 +00:00
info <- cabalBuildInfo <$> cabalParseFile "test/data/cabalapi.cabal"
2013-02-12 07:24:33 +00:00
let infoStr = show info
infoStr `shouldBe` "BuildInfo {buildable = True, buildTools = [], cppOptions = [], ccOptions = [], ldOptions = [], pkgconfigDepends = [], frameworks = [], cSources = [], hsSourceDirs = [], otherModules = [ModuleName [\"Browse\"],ModuleName [\"CabalApi\"],ModuleName [\"Cabal\"],ModuleName [\"CabalDev\"],ModuleName [\"Check\"],ModuleName [\"ErrMsg\"],ModuleName [\"Flag\"],ModuleName [\"GHCApi\"],ModuleName [\"GHCChoice\"],ModuleName [\"Gap\"],ModuleName [\"Info\"],ModuleName [\"Lang\"],ModuleName [\"Lint\"],ModuleName [\"List\"],ModuleName [\"Paths_ghc_mod\"],ModuleName [\"Types\"]], defaultLanguage = Nothing, otherLanguages = [], defaultExtensions = [], otherExtensions = [], oldExtensions = [], extraLibs = [], extraLibDirs = [], includeDirs = [], includes = [], installIncludes = [], options = [(GHC,[\"-Wall\"])], ghcProfOptions = [], ghcSharedOptions = [], customFieldsBI = [], targetBuildDepends = []}"