Add failing test for runGhcModT

This commit is contained in:
Daniel Gröber 2014-08-11 23:42:16 +02:00
parent b13465b588
commit c69b252e3c
4 changed files with 33 additions and 0 deletions

View File

@ -1,6 +1,9 @@
{-# LANGUAGE ScopedTypeVariables #-}
module MonadSpec where module MonadSpec where
import Test.Hspec import Test.Hspec
import Dir
import Control.Applicative
import Control.Monad.Error.Class import Control.Monad.Error.Class
import Language.Haskell.GhcMod.Types import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.Monad import Language.Haskell.GhcMod.Monad
@ -17,3 +20,8 @@ spec = do
return "hello" return "hello"
`catchError` (const $ fail "oh noes") `catchError` (const $ fail "oh noes")
a `shouldBe` (Left $ GMEString "oh noes") a `shouldBe` (Left $ GMEString "oh noes")
describe "runGhcModT" $
it "complains if the cabal file fails to parse while a sandbox is present" $ withDirectory_ "test/data/broken-cabal" $ do
(a,_) <- runGhcModT defaultOptions (gmCradle <$> ask)
a `shouldSatisfy` (\(Left _) -> True)

View File

@ -0,0 +1,25 @@
-- This is a Cabal package environment file.
-- THIS FILE IS AUTO-GENERATED. DO NOT EDIT DIRECTLY.
-- Please create a 'cabal.config' file in the same directory
-- if you want to change the default settings for this sandbox.
local-repo: @CWD@/test/data/broken-cabal/.cabal-sandbox/packages
logs-dir: @CWD@/test/data/broken-cabal/.cabal-sandbox/logs
world-file: @CWD@/test/data/broken-cabal/.cabal-sandbox/world
user-install: False
package-db: @CWD@/test/data/broken-cabal/.cabal-sandbox/x86_64-linux-ghc-7.8.3-packages.conf.d
build-summary: @CWD@/test/data/broken-cabal/.cabal-sandbox/logs/build.log
install-dirs
prefix: @CWD@/test/data/broken-cabal/.cabal-sandbox
bindir: $prefix/bin
libdir: $prefix/lib
libsubdir: $arch-$os-$compiler/$pkgid
libexecdir: $prefix/libexec
datadir: $prefix/share
datasubdir: $arch-$os-$compiler/$pkgid
docdir: $datadir/doc/$arch-$os-$compiler/$pkgid
htmldir: $docdir/html
haddockdir: $htmldir
sysconfdir: $prefix/etc