Merge pull request #154 from eagletmt/sandbox-dist
Fix `cabal install --enable-tests` in a sandbox environment
This commit is contained in:
commit
79a18ff379
@ -131,6 +131,8 @@ Test-Suite spec
|
|||||||
, time
|
, time
|
||||||
, transformers
|
, transformers
|
||||||
, hspec >= 1.7.1
|
, hspec >= 1.7.1
|
||||||
|
if impl(ghc < 7.6.0)
|
||||||
|
Build-Depends: executable-path
|
||||||
|
|
||||||
Source-Repository head
|
Source-Repository head
|
||||||
Type: git
|
Type: git
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
module InfoSpec where
|
module InfoSpec where
|
||||||
|
|
||||||
|
import Control.Applicative ((<$>))
|
||||||
import Data.List (isPrefixOf)
|
import Data.List (isPrefixOf)
|
||||||
import Language.Haskell.GhcMod
|
import Language.Haskell.GhcMod
|
||||||
import Language.Haskell.GhcMod.Cradle
|
import Language.Haskell.GhcMod.Cradle
|
||||||
|
#ifdef VERSION_executable_path
|
||||||
|
import System.Environment.Executable (getExecutablePath)
|
||||||
|
#else
|
||||||
|
import System.Environment (getExecutablePath)
|
||||||
|
#endif
|
||||||
import System.Exit
|
import System.Exit
|
||||||
|
import System.FilePath
|
||||||
import System.Process
|
import System.Process
|
||||||
import Test.Hspec
|
import Test.Hspec
|
||||||
|
|
||||||
@ -50,5 +58,9 @@ spec = do
|
|||||||
res `shouldSatisfy` ("bar :: [Char]" `isPrefixOf`)
|
res `shouldSatisfy` ("bar :: [Char]" `isPrefixOf`)
|
||||||
|
|
||||||
it "doesn't fail on unicode output" $ do
|
it "doesn't fail on unicode output" $ do
|
||||||
code <- rawSystem "dist/build/ghc-mod/ghc-mod" ["info", "test/data/Unicode.hs", "Unicode", "unicode"]
|
dir <- getDistDir
|
||||||
|
code <- rawSystem (dir </> "build/ghc-mod/ghc-mod") ["info", "test/data/Unicode.hs", "Unicode", "unicode"]
|
||||||
code `shouldSatisfy` (== ExitSuccess)
|
code `shouldSatisfy` (== ExitSuccess)
|
||||||
|
|
||||||
|
getDistDir :: IO FilePath
|
||||||
|
getDistDir = takeDirectory . takeDirectory . takeDirectory <$> getExecutablePath
|
||||||
|
Loading…
Reference in New Issue
Block a user