Fix tests, this time, this time for sure.

This commit is contained in:
Daniel Gröber 2015-09-08 06:42:32 +02:00
parent 7ae22a9226
commit dbf215a35b
3 changed files with 5 additions and 6 deletions

View File

@ -216,6 +216,5 @@ findFilesWith' f (d:ds) fileName = do
makeAbsolute' :: FilePath -> IO FilePath
makeAbsolute' = (normalise <$>) . absolutize
where absolutize path -- avoid the call to `getCurrentDirectory` if we can
| isRelative path = (</> path) . addTrailingPathSeparator <$>
getCurrentDirectory
| isRelative path = (</> path) <$> getCurrentDirectory
| otherwise = return path

View File

@ -9,7 +9,6 @@ import Language.Haskell.GhcMod.Error
import Test.Hspec
import System.Directory
import System.FilePath
import System.Process (readProcess, system)
import Prelude
import Dir

View File

@ -35,13 +35,14 @@ spec = do
describe "findStackConfigFile" $ do
it "works" $ do
findStackConfigFile "test/data/stack-project" `shouldReturn` Just "test/data/stack-project/stack.yaml"
p <- U.makeAbsolute' "test/data/stack-project/stack.yaml"
findStackConfigFile "test/data/stack-project" `shouldReturn` Just p
describe "findCabalSandboxDir" $ do
it "works" $ do
p <- U.makeAbsolute' "test/data/cabal-project/cabalapi.cabal"
p <- U.makeAbsolute' "test/data/cabal-project"
findCabalSandboxDir "test/data/cabal-project" `shouldReturn` Just p
it "finds sandboxes in parent directories" $ do
p <- U.makeAbsolute' "test/data/cabal-project/"
p <- U.makeAbsolute' "test/data/cabal-project"
findCabalSandboxDir "test/data/cabal-project/subdir1/subdir2" `shouldReturn` Just p