Skip to content

Commit c959050

Browse files
committed
Add tests for autogen-modules as main-is
1 parent 0e7d82b commit c959050

File tree

15 files changed

+140
-0
lines changed

15 files changed

+140
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LICENSE
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cabal-version: 3.12
2+
name: MainIsBench
3+
version: 0.1
4+
license: BSD-3-Clause
5+
license-file: LICENSE
6+
author: Federico Mastellone
7+
maintainer: Federico Mastellone
8+
synopsis: MainIsBench
9+
category: PackageTests
10+
build-type: Simple
11+
12+
description:
13+
Check if Cabal accepts an autogen-module in a benchmark as the main-is field.
14+
15+
Benchmark Bench
16+
default-language: Haskell2010
17+
main-is: MyDummy.hs
18+
type: exitcode-stdio-1.0
19+
build-depends: base == 4.*
20+
other-modules:
21+
MyDummy
22+
autogen-modules:
23+
MyDummy
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Setup configure
2+
Configuring MainIsBench-0.1...
3+
# Setup sdist
4+
Building source dist for MainIsBench-0.1...
5+
Error: [Cabal-2115]
6+
MyDummy.hs doesn't exist
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Setup configure
2+
Configuring MainIsBench-0.1...
3+
# Setup sdist
4+
Building source dist for MainIsBench-0.1...
5+
Error: [Cabal-2115]
6+
MyDummy.hs doesn't exist
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Test.Cabal.Prelude
2+
3+
-- Test that setup shows all the 'autogen-modules' warnings.
4+
main = setupAndCabalTest $ do
5+
6+
configureResult <- setup' "configure" []
7+
assertOutputDoesNotContain "MyDummy.hs doesn't exist" configureResult
8+
sdistResult <- fails $ setup' "sdist" []
9+
assertOutputContains "MyDummy.hs doesn't exist" sdistResult
10+
11+
return ()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LICENSE
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cabal-version: 3.12
2+
name: MainIsExe
3+
version: 0.1
4+
license: BSD-3-Clause
5+
license-file: LICENSE
6+
author: Federico Mastellone
7+
maintainer: Federico Mastellone
8+
synopsis: AutogenModules
9+
category: PackageTests
10+
build-type: Simple
11+
12+
description:
13+
Check if Cabal accepts an autogen-module in an executable as the main-is field.
14+
15+
Executable Exe
16+
default-language: Haskell2010
17+
main-is: MyDummy.hs
18+
build-depends: base == 4.*
19+
other-modules:
20+
MyDummy
21+
autogen-modules:
22+
MyDummy
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Setup configure
2+
Configuring MainIsExe-0.1...
3+
# Setup sdist
4+
Building source dist for MainIsExe-0.1...
5+
Error: [Cabal-2115]
6+
MyDummy.hs doesn't exist
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Setup configure
2+
Configuring MainIsExe-0.1...
3+
# Setup sdist
4+
Building source dist for MainIsExe-0.1...
5+
Error: [Cabal-2115]
6+
MyDummy.hs doesn't exist
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Test.Cabal.Prelude
2+
3+
-- Test that setup shows all the 'autogen-modules' warnings.
4+
main = setupAndCabalTest $ do
5+
6+
configureResult <- setup' "configure" []
7+
assertOutputDoesNotContain "MyDummy.hs doesn't exist" configureResult
8+
sdistResult <- fails $ setup' "sdist" []
9+
assertOutputContains "MyDummy.hs doesn't exist" sdistResult
10+
11+
return ()

0 commit comments

Comments
 (0)