Ghc -> GhcMod: Browse, Check
This commit is contained in:
@@ -6,6 +6,7 @@ import Language.Haskell.GhcMod.Cradle
|
||||
import System.FilePath
|
||||
import Test.Hspec
|
||||
|
||||
import TestUtils
|
||||
import Dir
|
||||
|
||||
spec :: Spec
|
||||
@@ -13,26 +14,22 @@ spec = do
|
||||
describe "checkSyntax" $ do
|
||||
it "can check even if an executable depends on its library" $ do
|
||||
withDirectory_ "test/data/ghc-mod-check" $ do
|
||||
cradle <- findCradleWithoutSandbox
|
||||
res <- checkSyntax defaultOptions cradle ["main.hs"]
|
||||
res <- runID $ checkSyntax ["main.hs"]
|
||||
res `shouldBe` "main.hs:5:1:Warning: Top-level binding with no type signature: main :: IO ()\n"
|
||||
|
||||
it "can check even if a test module imports another test module located at different directory" $ do
|
||||
withDirectory_ "test/data/check-test-subdir" $ do
|
||||
cradle <- findCradleWithoutSandbox
|
||||
res <- checkSyntax defaultOptions cradle ["test/Bar/Baz.hs"]
|
||||
res <- runID $ checkSyntax ["test/Bar/Baz.hs"]
|
||||
res `shouldSatisfy` (("test" </> "Foo.hs:3:1:Warning: Top-level binding with no type signature: foo :: [Char]\n") `isSuffixOf`)
|
||||
|
||||
it "can detect mutually imported modules" $ do
|
||||
withDirectory_ "test/data" $ do
|
||||
cradle <- findCradleWithoutSandbox
|
||||
res <- checkSyntax defaultOptions cradle ["Mutual1.hs"]
|
||||
res <- runID $ checkSyntax ["Mutual1.hs"]
|
||||
res `shouldSatisfy` ("Module imports form a cycle" `isInfixOf`)
|
||||
|
||||
it "can check a module using QuasiQuotes" $ do
|
||||
withDirectory_ "test/data" $ do
|
||||
cradle <- findCradleWithoutSandbox
|
||||
res <- checkSyntax defaultOptions cradle ["Baz.hs"]
|
||||
res <- runID $ checkSyntax ["Baz.hs"]
|
||||
res `shouldSatisfy` ("Baz.hs:5:1:Warning:" `isPrefixOf`)
|
||||
|
||||
context "without errors" $ do
|
||||
|
||||
Reference in New Issue
Block a user