(cabal check) Add "No duplicate names" test
[cabal.git] / cabal-testsuite / PackageTests / ShowBuildInfo / CompileFail / compile-fail.test.hs
blobfc1fba234d5afb1c79caada36b242cd46f7a46ed
1 {-# LANGUAGE OverloadedStrings #-}
2 import Test.Cabal.Prelude
3 import Test.Cabal.DecodeShowBuildInfo
4 import Test.Cabal.Plan
5 import Control.Monad.Trans.Reader
7 main = cabalTest $ do
8 -- Leaf component fails to compile, should still dump
9 -- build info for both components.
10 fails $ runShowBuildInfo ["test:CompileFail-test"]
11 withPlan $ do
12 -- Lib has to be built, thus info is dumped
13 assertComponent "CompileFail" mainLib
14 defCompAssertion
15 { modules = ["MyLib"]
16 , sourceDirs = ["src"]
19 -- Build Info is still dumped, although compilation failed
20 assertComponent "CompileFail" (test "CompileFail-test")
21 defCompAssertion
22 { sourceFiles = ["Main.hs"]
23 , sourceDirs = ["test"]
26 fails $ runShowBuildInfo ["exe:CompileFail-exe"]
27 withPlan $ do
28 -- Internal Lib has to be built, thus info is dumped
29 assertComponent "CompileFail" (lib "failing")
30 defCompAssertion
31 { modules = ["MyLib2"]
32 , sourceDirs = ["src"]
34 -- However, since the internal lib failed to compile
35 -- we can not have executable build information.
36 Just plan <- fmap testPlan ask
37 let fp = buildInfoFile plan "CompileFail" (exe "CompileFail-exe")
38 shouldNotExist fp