refactoring for testing.

This commit is contained in:
Kazu Yamamoto
2013-03-04 18:11:09 +09:00
parent 69cc0f8ce4
commit 1047c76906
6 changed files with 47 additions and 49 deletions

View File

@@ -1,5 +1,6 @@
module CheckSpec where
import CabalApi
import Check
import Cradle
import Expectation
@@ -11,6 +12,7 @@ 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 <- findCradle Nothing
(strVer,_) <- getGHCVersion
cradle <- findCradle Nothing strVer
res <- checkSyntax defaultOptions cradle "main.hs"
res `shouldBe` "main.hs:5:1:Warning: Top-level binding with no type signature: main :: IO ()\NUL\n"

View File

@@ -1,5 +1,6 @@
module InfoSpec where
import CabalApi
import Cradle
import Expectation
import Info
@@ -11,6 +12,7 @@ spec = do
describe "typeExpr" $ do
it "shows types of the expression and its outers" $ do
withDirectory "test/data/ghc-mod-check" $ do
cradle <- findCradle Nothing
(strVer,_) <- getGHCVersion
cradle <- findCradle Nothing strVer
res <- typeExpr defaultOptions cradle "Data.Foo" 9 5 "Data/Foo.hs"
res `shouldBe` "9 5 11 40 \"Int -> a -> a -> a\"\n7 1 11 40 \"Int -> Integer\"\n"