(cabal check) Add "Version signatures" test
[cabal.git] / cabal-testsuite / PackageTests / Regression / T5409 / use-different-versions-of-dependency-for-library-and-build-tool.test.hs
blob13215e65c6d9200edddbee3c95c44f6a62763d7a
1 import Test.Cabal.Prelude
3 -- The local package, pkg-1.0, depends on build-tool-pkg-1 as a library and
4 -- build-tool-pkg-2 as a build-tool. This test checks that cabal uses the
5 -- correct version of build-tool-pkg for each purpose. pkg imports a version
6 -- number from the build-tool-pkg library and uses the build-tool-pkg executable
7 -- as a preprocessor to insert the executable's version number into the source
8 -- code. Then the pkg executable prints out both versions.
9 --
10 -- Issue #5409 caused v2-build to use the same instance of build-tool-pkg for
11 -- the build-depends and build-tool-depends dependencies, even though it
12 -- violated the version constraints.
13 main = withShorterPathForNewBuildStore $ \storeDir ->
14 cabalTest $ do
15 skipUnless "not v2-build compatible boot Cabal" =<< hasNewBuildCompatBootCabal
16 withRepo "repo" $ do
17 r1 <- recordMode DoNotRecord $
18 cabalG' ["--store-dir=" ++ storeDir] "v2-build" ["pkg:my-exe"]
20 let msg = concat
21 [ "In order, the following will be built:"
22 , " - build-tool-pkg-1 (lib) (requires build)"
23 , " - build-tool-pkg-2 (lib) (requires build)"
24 , " - build-tool-pkg-2 (exe:build-tool-exe) (requires build)"
25 , " - pkg-1.0 (exe:my-exe) (first run)"
28 assertOutputContains msg r1
29 withPlan $ do
30 r2 <- runPlanExe' "pkg" "my-exe" []
31 assertOutputContains
32 "build-tool library version: 1, build-tool exe version: 2" r2