Skip to content

Commit 0e52b8c

Browse files
committed
Add test for haskell#7423
i.e. Do not warn on -O2 if flag conditional
1 parent e44bcc0 commit 0e52b8c

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# cabal check
2+
No errors or warnings could be found in the package.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Test.Cabal.Prelude
2+
3+
-- Do not output warning when an -O2 is behind a cabal flag.
4+
main = cabalTest $ cabal "check" []
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cabal-version: 2.2
2+
name: pkg
3+
version: 0
4+
category: example
5+
maintainer: [email protected]
6+
synopsis: synopsys
7+
description: description
8+
license: GPL-3.0-or-later
9+
10+
flag force-O2
11+
default: False
12+
manual: True
13+
14+
library
15+
exposed-modules: Foo
16+
default-language: Haskell2010
17+
if flag(force-O2)
18+
ghc-options: -O2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# cabal check
2+
Warning: These warnings may cause trouble when distributing the package:
3+
Warning: 'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit and not just imposing longer compile times on your users.
4+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Test.Cabal.Prelude
2+
3+
-- Do not output warning when an -O2 is behind a cabal flag.
4+
main = cabalTest $ cabal "check" []
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cabal-version: 2.2
2+
name: pkg
3+
version: 0
4+
category: example
5+
maintainer: [email protected]
6+
synopsis: synopsys
7+
description: description
8+
license: GPL-3.0-or-later
9+
10+
flag force-O2
11+
default: False
12+
manual: True
13+
14+
library
15+
exposed-modules: Foo
16+
default-language: Haskell2010
17+
ghc-options: -O2
18+
if flag(force-O2)
19+
ghc-options: -O2

0 commit comments

Comments
 (0)