Commit 3e17abec authored by Mikhail Glushenkov's avatar Mikhail Glushenkov Committed by GitHub
Browse files

Merge pull request #4482 from grayjay/local-version-test

Add an integration test for choosing to build the local version of a package.
parents d714c9b9 58c2d1dc
name: pkg
version: 1.0
build-type: Simple
cabal-version: >= 1.2
executable my-exe
main-is: Main.hs
build-depends: base
name: pkg
version: 1.0
build-type: Simple
cabal-version: >= 1.2
executable my-exe
main-is: Main.hs
build-depends: base
name: pkg
version: 2.0
build-type: Simple
cabal-version: >= 1.2
executable my-exe
main-is: Main.hs
build-depends: base
# cabal update
Downloading the latest package list from test-local-repo
# cabal new-build
Resolving dependencies...
In order, the following will be built:
- pkg-1.0 (exe:my-exe) (first run)
Configuring pkg-1.0...
Preprocessing executable 'my-exe' for pkg-1.0..
Building executable 'my-exe' for pkg-1.0..
# pkg my-exe
local pkg-1.0
# cabal new-build
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: pkg (user goal)
rejecting: pkg-2.0 (constraint from user target requires ==1.0)
rejecting: pkg-1.0 (constraint from command line flag requires ==2.0)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: pkg (3)
import Test.Cabal.Prelude
-- Test that "cabal new-build pkg" builds the local pkg-1.0, which has an exe
-- that prints a unique message. It should not build 1.0 or 2.0 from the
-- repository.
main = cabalTest $ withRepo "repo" $ do
cabal "new-build" ["pkg"]
withPlan $ do
r <- runPlanExe' "pkg" "my-exe" []
assertOutputContains "local pkg-1.0" r
-- cabal shouldn't build a package from the repo, even when given a constraint
-- that only matches a non-local package.
r <- fails $ cabal' "new-build" ["pkg", "--constraint=pkg==2.0"]
assertOutputContains "rejecting: pkg-2.0" r
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment