Check.hs 890 Bytes
Newer Older
1
2
3
4
5
6
module PackageTests.BuildDeps.TargetSpecificDeps3.Check where

import Test.HUnit
import PackageTests.PackageTester
import System.FilePath
import Data.List
7
import qualified Control.Exception as E
8
import Text.Regex.Posix
9
10
11
12
13
14


suite :: Test
suite = TestCase $ do
    let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "TargetSpecificDeps3") []
    result <- cabal_build spec
tibbe's avatar
tibbe committed
15
16
17
18
19
    do
        assertEqual "cabal build should fail - see test-log.txt" False (successful result)
        assertBool "error should be in lemon.hs" $
            "lemon.hs:" `isInfixOf` outputText result
        assertBool "error should be \"Could not find module `System.Time\"" $
20
21
            (intercalate " " $ lines $ outputText result)
            =~ "Could not find module.*System.Time"
22
      `E.catch` \exc -> do
tibbe's avatar
tibbe committed
23
        putStrLn $ "Cabal result was "++show result
24
        E.throwIO (exc :: E.SomeException)