CabalSpec.hs 1.0 KB

123456789101112131415161718192021222324
  1. module CabalSpec where
  2. import Control.Applicative
  3. import System.Directory
  4. import Test.Hspec
  5. import Cabal
  6. import Expectation
  7. spec :: Spec
  8. spec = do
  9. describe "getDirs" $ do
  10. it "obtains two directories and a cabal file" $ do
  11. len <- length <$> getCurrentDirectory
  12. withDirectory "test/data/subdir1/subdir2" $ do
  13. (x,y,z) <- getDirs
  14. (drop len x, drop len y, drop len z) `shouldBe` ("/test/data/subdir1/subdir2","/test/data","/test/data/cabalapi.cabal")
  15. describe "getDirs" $ do
  16. it "obtains two directories and a cabal file" $ do
  17. len <- length <$> getCurrentDirectory
  18. withDirectory "test/data/subdir1/subdir2" $ do
  19. (x,y,z) <- fromCabal []
  20. (x, map (drop len) y, z) `shouldBe` (["-XHaskell98"],["/test/data","/test/data/subdir1/subdir2"],["Cabal","base","containers","convertible","directory","filepath","ghc","ghc-paths","ghc-syb-utils","hlint","hspec","io-choice","old-time","process","regex-posix","syb","time","transformers"])