From 37230a6a2309605f13cc83fea88fff553a38347d Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sun, 17 Dec 2017 15:25:11 +0100 Subject: [PATCH] Test for new defaulting-logic This tweaks the existing `CustomPlain` test to test the legacy defaulting logic for the unconditionally `Custom` default. Morever, a new `SimpleDefault` test has been added which tests that `cabal-version:2.1` does indeed infer `build-type: Simple` when there is no `custom-setup` stanza defined. --- cabal-testsuite/PackageTests/CustomPlain/plain.cabal | 1 - cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out | 1 + cabal-testsuite/PackageTests/CustomPlain/setup.out | 1 + cabal-testsuite/PackageTests/SimpleDefault/M.hs | 1 + cabal-testsuite/PackageTests/SimpleDefault/Setup.hs | 2 ++ cabal-testsuite/PackageTests/SimpleDefault/cabal.project | 1 + cabal-testsuite/PackageTests/SimpleDefault/cabal.test.hs | 6 ++++++ cabal-testsuite/PackageTests/SimpleDefault/my.cabal | 10 ++++++++++ 8 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 cabal-testsuite/PackageTests/SimpleDefault/M.hs create mode 100644 cabal-testsuite/PackageTests/SimpleDefault/Setup.hs create mode 100644 cabal-testsuite/PackageTests/SimpleDefault/cabal.project create mode 100644 cabal-testsuite/PackageTests/SimpleDefault/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/SimpleDefault/my.cabal diff --git a/cabal-testsuite/PackageTests/CustomPlain/plain.cabal b/cabal-testsuite/PackageTests/CustomPlain/plain.cabal index 4046fc743..d0666a10f 100644 --- a/cabal-testsuite/PackageTests/CustomPlain/plain.cabal +++ b/cabal-testsuite/PackageTests/CustomPlain/plain.cabal @@ -3,7 +3,6 @@ version: 0.1.0.0 license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu -build-type: Custom cabal-version: >=1.10 library diff --git a/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out b/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out index b9ec9698b..ef6fc6dad 100644 --- a/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out +++ b/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out @@ -1,6 +1,7 @@ # Setup configure Resolving dependencies... Configuring plain-0.1.0.0... +Warning: No 'build-type' specified. If you do not need a custom Setup.hs or ./configure script then use 'build-type: Simple'. # Setup build Preprocessing library for plain-0.1.0.0.. Building library for plain-0.1.0.0.. diff --git a/cabal-testsuite/PackageTests/CustomPlain/setup.out b/cabal-testsuite/PackageTests/CustomPlain/setup.out index e65ff6cc7..aa27e506c 100644 --- a/cabal-testsuite/PackageTests/CustomPlain/setup.out +++ b/cabal-testsuite/PackageTests/CustomPlain/setup.out @@ -1,5 +1,6 @@ # Setup configure Configuring plain-0.1.0.0... +Warning: No 'build-type' specified. If you do not need a custom Setup.hs or ./configure script then use 'build-type: Simple'. # Setup build Preprocessing library for plain-0.1.0.0.. Building library for plain-0.1.0.0.. diff --git a/cabal-testsuite/PackageTests/SimpleDefault/M.hs b/cabal-testsuite/PackageTests/SimpleDefault/M.hs new file mode 100644 index 000000000..ef2ad8bb3 --- /dev/null +++ b/cabal-testsuite/PackageTests/SimpleDefault/M.hs @@ -0,0 +1 @@ +module M where diff --git a/cabal-testsuite/PackageTests/SimpleDefault/Setup.hs b/cabal-testsuite/PackageTests/SimpleDefault/Setup.hs new file mode 100644 index 000000000..2ee479d6a --- /dev/null +++ b/cabal-testsuite/PackageTests/SimpleDefault/Setup.hs @@ -0,0 +1,2 @@ +main :: IO () +main = fail "Setup called despite `build-type:Simple`" diff --git a/cabal-testsuite/PackageTests/SimpleDefault/cabal.project b/cabal-testsuite/PackageTests/SimpleDefault/cabal.project new file mode 100644 index 000000000..e6fdbadb4 --- /dev/null +++ b/cabal-testsuite/PackageTests/SimpleDefault/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/SimpleDefault/cabal.test.hs b/cabal-testsuite/PackageTests/SimpleDefault/cabal.test.hs new file mode 100644 index 000000000..2a3c602da --- /dev/null +++ b/cabal-testsuite/PackageTests/SimpleDefault/cabal.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + recordMode DoNotRecord $ do + -- TODO: Hack; see also CustomDep/cabal.test.hs + withEnvFilter (/= "HOME") $ do + cabal "new-build" ["all"] diff --git a/cabal-testsuite/PackageTests/SimpleDefault/my.cabal b/cabal-testsuite/PackageTests/SimpleDefault/my.cabal new file mode 100644 index 000000000..5dd8aeb80 --- /dev/null +++ b/cabal-testsuite/PackageTests/SimpleDefault/my.cabal @@ -0,0 +1,10 @@ +cabal-version: 2.1 +name: my +version: 0 +-- tests whether the default is `build-type: Simple` +-- (for cabal-version >= 2.1) + +library + exposed-modules: M + build-depends: base + default-language: Haskell2010 -- 2.11.4.GIT