Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
qnikst committed Jun 9, 2018
1 parent 308fb32 commit cc745b8
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/CheckSetup/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LICENSE
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/CheckSetup/MyLibrary.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module MyLibrary () where
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/CheckSetup/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
25 changes: 25 additions & 0 deletions cabal-testsuite/PackageTests/CheckSetup/my.cabal
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions cabal-testsuite/PackageTests/CheckSetup/setup.test.hs
Original file line number Diff line number Diff line change
@@ -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 ()

0 comments on commit cc745b8

Please sign in to comment.