Merge pull request #818 from atom-haskell/stack-test
Make tests work under `stack test`
This commit is contained in:
commit
0b144ef0b2
@ -40,7 +40,7 @@ import System.IO.Temp (createTempDirectory)
|
|||||||
import System.Process (readProcess)
|
import System.Process (readProcess)
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
|
|
||||||
import Paths_ghc_mod (getLibexecDir)
|
import Paths_ghc_mod (getLibexecDir, getBinDir)
|
||||||
import Utils
|
import Utils
|
||||||
import Prelude
|
import Prelude
|
||||||
|
|
||||||
@ -84,7 +84,11 @@ ghcModExecutable = do
|
|||||||
dir <- takeDirectory <$> getExecutablePath'
|
dir <- takeDirectory <$> getExecutablePath'
|
||||||
return $ (if dir == "." then "" else dir) </> "ghc-mod"
|
return $ (if dir == "." then "" else dir) </> "ghc-mod"
|
||||||
#else
|
#else
|
||||||
ghcModExecutable = fmap (</> "dist/build/ghc-mod/ghc-mod") getCurrentDirectory
|
ghcModExecutable = do
|
||||||
|
gpp <- lookupEnv "STACK_EXE"
|
||||||
|
case gpp of
|
||||||
|
Just _ -> fmap (</> "ghc-mod") getBinDir
|
||||||
|
_ -> fmap (</> "dist/build/ghc-mod/ghc-mod") getCurrentDirectory
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
getExecutablePath' :: IO FilePath
|
getExecutablePath' :: IO FilePath
|
||||||
|
@ -7,11 +7,15 @@ import Control.Monad (void)
|
|||||||
import Data.List
|
import Data.List
|
||||||
import Language.Haskell.GhcMod (debugInfo)
|
import Language.Haskell.GhcMod (debugInfo)
|
||||||
import System.Process
|
import System.Process
|
||||||
|
import System.Environment
|
||||||
import Test.Hspec
|
import Test.Hspec
|
||||||
import TestUtils
|
import TestUtils
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
|
#if __GLASGOW_HASKELL__ >= 708
|
||||||
|
unsetEnv "GHC_PACKAGE_PATH"
|
||||||
|
#endif
|
||||||
let sandboxes = [ "test/data/cabal-project"
|
let sandboxes = [ "test/data/cabal-project"
|
||||||
, "test/data/check-packageid"
|
, "test/data/check-packageid"
|
||||||
, "test/data/duplicate-pkgver/"
|
, "test/data/duplicate-pkgver/"
|
||||||
|
Loading…
Reference in New Issue
Block a user