Add test cases that reproduce #7241.
[cabal.git] / cabal-testsuite / PackageTests / BuildTargets / UseLocalPackage / use-local-version-of-package.test.hs
blob20d501abfc60bb5b66e1712aad5e20cff039fdbf
1 import Test.Cabal.Prelude
3 -- Test that "cabal v2-build pkg" builds the local pkg-1.0, which has an exe
4 -- that prints a unique message. It should not build 1.0 or 2.0 from the
5 -- repository.
6 main = cabalTest $ withRepo "repo" $ do
7 cabal "v2-build" ["pkg"]
8 withPlan $ do
9 r <- runPlanExe' "pkg" "my-exe" []
10 assertOutputContains "local pkg-1.0" r
12 -- cabal shouldn't build a package from the repo, even when given a constraint
13 -- that only matches a non-local package.
14 r <- fails $ cabal' "v2-build" ["pkg", "-c", "pkg==2.0"]
15 assertOutputContains "rejecting: pkg-2.0" r