From cc745b8857dc15db01e9e03ad207f4f0cf012158 Mon Sep 17 00:00:00 2001 From: Alexander Vershilov Date: Sat, 9 Jun 2018 18:22:06 +0300 Subject: [PATCH] Add tests. --- .../PackageTests/CheckSetup/LICENSE | 1 + .../PackageTests/CheckSetup/MyLibrary.hs | 1 + .../PackageTests/CheckSetup/Setup.hs | 2 ++ .../PackageTests/CheckSetup/my.cabal | 25 +++++++++++++++++++ .../PackageTests/CheckSetup/setup.test.hs | 24 ++++++++++++++++++ 5 files changed, 53 insertions(+) create mode 100644 cabal-testsuite/PackageTests/CheckSetup/LICENSE create mode 100644 cabal-testsuite/PackageTests/CheckSetup/MyLibrary.hs create mode 100644 cabal-testsuite/PackageTests/CheckSetup/Setup.hs create mode 100644 cabal-testsuite/PackageTests/CheckSetup/my.cabal create mode 100644 cabal-testsuite/PackageTests/CheckSetup/setup.test.hs diff --git a/cabal-testsuite/PackageTests/CheckSetup/LICENSE b/cabal-testsuite/PackageTests/CheckSetup/LICENSE new file mode 100644 index 00000000000..6b1d0bfabc3 --- /dev/null +++ b/cabal-testsuite/PackageTests/CheckSetup/LICENSE @@ -0,0 +1 @@ +LICENSE diff --git a/cabal-testsuite/PackageTests/CheckSetup/MyLibrary.hs b/cabal-testsuite/PackageTests/CheckSetup/MyLibrary.hs new file mode 100644 index 00000000000..a51c414bcd2 --- /dev/null +++ b/cabal-testsuite/PackageTests/CheckSetup/MyLibrary.hs @@ -0,0 +1 @@ +module MyLibrary () where diff --git a/cabal-testsuite/PackageTests/CheckSetup/Setup.hs b/cabal-testsuite/PackageTests/CheckSetup/Setup.hs new file mode 100644 index 00000000000..9a994af677b --- /dev/null +++ b/cabal-testsuite/PackageTests/CheckSetup/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/cabal-testsuite/PackageTests/CheckSetup/my.cabal b/cabal-testsuite/PackageTests/CheckSetup/my.cabal new file mode 100644 index 00000000000..538e6375142 --- /dev/null +++ b/cabal-testsuite/PackageTests/CheckSetup/my.cabal @@ -0,0 +1,25 @@ +name: CheckSetup +version: 0.1 +license: BSD3 +license-file: LICENSE +author: Alexander Vershilov +maintainer: Alexander Vershilov +synopsis: Check setup +category: PackageTests +build-type: Custom +cabal-version: 2.0 + +description: + Check that Cabal recognizes problems with setup module. + +custom-setup + setup-depends: + base, + Cabal, + bytestring + +Library + default-language: Haskell2010 + build-depends: base <5.0 + exposed-modules: + MyLibrary diff --git a/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs b/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs new file mode 100644 index 00000000000..7a176265e39 --- /dev/null +++ b/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs @@ -0,0 +1,24 @@ +import Test.Cabal.Prelude + +-- Test that setup shows all the 'autogen-modules' warnings. +main = setupAndCabalTest $ do + + checkResult <- fails $ cabal_raw' ["check"] + + -- Package check messages. + let libWarning= + "The dependency 'build-depends: 'bytestring' does not " + ++ "specify an upper bound on the version number." + libError1 = + "The dependency 'setup-depends: 'Cabal' does not specify " + ++ "an upper bound on the version number" + libError2 = + "The dependency 'setup-depends: 'base' does not specify " + ++ "an upper bound on the version number" + + -- Asserts for the desired check messages after configure. + assertOutputContains libWarning checkResult + assertOutputContains libError1 checkResult + assertOutputContains libError2 checkResult + + return ()