Fix findCabalFile
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
module CabalApiSpec where
|
||||
|
||||
import Control.Applicative
|
||||
import Data.Maybe
|
||||
import Language.Haskell.GhcMod.CabalApi
|
||||
import Language.Haskell.GhcMod.Cradle
|
||||
import Language.Haskell.GhcMod.Types
|
||||
@@ -35,7 +34,7 @@ spec = do
|
||||
cwd <- getCurrentDirectory
|
||||
withDirectory "test/data/subdir1/subdir2" $ \dir -> do
|
||||
crdl <- findCradle
|
||||
let cabalFile = cradleCabalFile crdl
|
||||
let Just cabalFile = cradleCabalFile crdl
|
||||
pkgDesc <- runD $ parseCabalFile crdl cabalFile
|
||||
res <- runD $ getCompilerOptions [] crdl pkgDesc
|
||||
let res' = res {
|
||||
|
||||
@@ -33,3 +33,10 @@ spec = do
|
||||
describe "getCabalFiles" $ do
|
||||
it "doesn't think $HOME/.cabal is a cabal file" $ do
|
||||
(getCabalFiles =<< getEnv "HOME") `shouldReturn` []
|
||||
|
||||
describe "findCabalFile" $ do
|
||||
it "works" $ do
|
||||
findCabalFile "test/data" `shouldReturn` Just "test/data/cabalapi.cabal"
|
||||
|
||||
it "finds cabal files in parent directories" $ do
|
||||
findCabalFile "test/data/subdir1/subdir2" `shouldReturn` Just "test/data/cabalapi.cabal"
|
||||
|
||||
Reference in New Issue
Block a user