Gather all hs-source-dirs to check test modules in sub-directories

This commit is contained in:
eagletmt
2013-03-15 17:30:21 +09:00
parent 8d7b0d365b
commit 24ada2abeb
8 changed files with 51 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ module CheckSpec where
import CabalApi
import Check
import Cradle
import Data.List (isSuffixOf)
import Expectation
import Test.Hspec
import Types
@@ -16,3 +17,9 @@ spec = do
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"
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 <- getGHCVersion >>= findCradle Nothing . fst
res <- checkSyntax defaultOptions cradle "test/Bar/Baz.hs"
res `shouldSatisfy` ("test/Foo.hs:3:1:Warning: Top-level binding with no type signature: foo :: [Char]\NUL\n" `isSuffixOf`)