From b2ee4c3db475f058b70688b28f5e1870fe60af66 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Sun, 17 Apr 2016 22:55:08 +0200 Subject: [PATCH] Add a test for #3199. (cherry picked from commit d70c9aabd7bc0e4154bf5d93e6ce84711f8d2628) --- cabal-install/cabal-install.cabal | 4 +++ .../IntegrationTests/regression/t3199.sh | 12 +++++++++ .../IntegrationTests/regression/t3199/Main.hs | 4 +++ .../regression/t3199/Setup.hs | 2 ++ .../regression/t3199/test-3199.cabal | 27 +++++++++++++++++++ 5 files changed, 49 insertions(+) create mode 100644 cabal-install/tests/IntegrationTests/regression/t3199.sh create mode 100644 cabal-install/tests/IntegrationTests/regression/t3199/Main.hs create mode 100644 cabal-install/tests/IntegrationTests/regression/t3199/Setup.hs create mode 100644 cabal-install/tests/IntegrationTests/regression/t3199/test-3199.cabal diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index ff6b26b9c65..70fd0bfae99 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -84,6 +84,10 @@ Extra-Source-Files: tests/IntegrationTests/new-build/monitor_cabal_files/q/Setup.hs tests/IntegrationTests/new-build/monitor_cabal_files/q/q-broken.cabal.in tests/IntegrationTests/new-build/monitor_cabal_files/q/q-fixed.cabal.in + tests/IntegrationTests/regression/t3199.sh + tests/IntegrationTests/regression/t3199/Main.hs + tests/IntegrationTests/regression/t3199/Setup.hs + tests/IntegrationTests/regression/t3199/test-3199.cabal tests/IntegrationTests/sandbox-sources/fail_removing_source_thats_not_registered.err tests/IntegrationTests/sandbox-sources/fail_removing_source_thats_not_registered.sh tests/IntegrationTests/sandbox-sources/p/Setup.hs diff --git a/cabal-install/tests/IntegrationTests/regression/t3199.sh b/cabal-install/tests/IntegrationTests/regression/t3199.sh new file mode 100644 index 00000000000..f6b4244fc7f --- /dev/null +++ b/cabal-install/tests/IntegrationTests/regression/t3199.sh @@ -0,0 +1,12 @@ +. ./common.sh + +if [[ `ghc --numeric-version` =~ "7\\." ]]; then + cd t3199 + tmpfile=$(mktemp /tmp/cabal-t3199.XXXXXX) + cabal sandbox init + cabal sandbox add-source ../../../../../Cabal + cabal install --package-db=clear --package-db=global --only-dep --dry-run > $tmpfile + grep -q "the following would be installed" $tmpfile || die "Should've installed Cabal" + grep -q Cabal $tmpfile || die "Should've installed Cabal" + rm $tmpfile +fi diff --git a/cabal-install/tests/IntegrationTests/regression/t3199/Main.hs b/cabal-install/tests/IntegrationTests/regression/t3199/Main.hs new file mode 100644 index 00000000000..65ae4a05d5d --- /dev/null +++ b/cabal-install/tests/IntegrationTests/regression/t3199/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = putStrLn "Hello, Haskell!" diff --git a/cabal-install/tests/IntegrationTests/regression/t3199/Setup.hs b/cabal-install/tests/IntegrationTests/regression/t3199/Setup.hs new file mode 100644 index 00000000000..9a994af677b --- /dev/null +++ b/cabal-install/tests/IntegrationTests/regression/t3199/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/cabal-install/tests/IntegrationTests/regression/t3199/test-3199.cabal b/cabal-install/tests/IntegrationTests/regression/t3199/test-3199.cabal new file mode 100644 index 00000000000..93e94c20bbb --- /dev/null +++ b/cabal-install/tests/IntegrationTests/regression/t3199/test-3199.cabal @@ -0,0 +1,27 @@ +name: test-t3199 +version: 0.1.0.0 +license: BSD3 +author: Mikhail Glushenkov +maintainer: mikhail.glushenkov@gmail.com +category: Test +build-type: Custom +cabal-version: >=1.10 + +flag exe_2 + description: Build second exe + default: False + +executable test-3199-1 + main-is: Main.hs + build-depends: base + default-language: Haskell2010 + +executable test-3199-2 + main-is: Main.hs + build-depends: base, ansi-terminal + default-language: Haskell2010 + + if flag(exe_2) + buildable: True + else + buildable: False