Skip to content

Commit 38f189f

Browse files
committed
Re-design test-cases for show-build-info
1 parent 8bdc331 commit 38f189f

File tree

33 files changed

+614
-6
lines changed

33 files changed

+614
-6
lines changed

cabal-testsuite/PackageTests/Configure/include/HsZlibConfig.h.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
/* Define to 1 if you have the <inttypes.h> header file. */
44
#undef HAVE_INTTYPES_H
55

6-
/* Define to 1 if you have the <memory.h> header file. */
7-
#undef HAVE_MEMORY_H
8-
96
/* Define to 1 if you have the <stdint.h> header file. */
107
#undef HAVE_STDINT_H
118

9+
/* Define to 1 if you have the <stdio.h> header file. */
10+
#undef HAVE_STDIO_H
11+
1212
/* Define to 1 if you have the <stdlib.h> header file. */
1313
#undef HAVE_STDLIB_H
1414

@@ -45,5 +45,7 @@
4545
/* Define to the version of this package. */
4646
#undef PACKAGE_VERSION
4747

48-
/* Define to 1 if you have the ANSI C header files. */
48+
/* Define to 1 if all of the C90 standard headers exist (not just the ones
49+
required in a freestanding environment). This macro is provided for
50+
backward compatibility; new code need not use it. */
4951
#undef STDC_HEADERS
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
cabal-version: 2.4
2+
name: A
3+
version: 0.1.0.0
4+
license: BSD-3-Clause
5+
6+
library
7+
exposed-modules: A
8+
build-depends: base >=4
9+
hs-source-dirs: src
10+
default-language: Haskell2010
11+
12+
executable A
13+
main-is: Main.hs
14+
build-depends: base >=4
15+
hs-source-dirs: src
16+
default-language: Haskell2010
17+
18+
test-suite A-tests
19+
type: exitcode-stdio-1.0
20+
main-is: Test.hs
21+
build-depends: base >=4, A
22+
hs-source-dirs: src
23+
default-language: Haskell2010
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cabal-version: 2.4
2+
name: B
3+
version: 0.1.0.0
4+
license: BSD-3-Clause
5+
6+
library
7+
exposed-modules: B
8+
build-depends: base >=4.0.0.0, A
9+
hs-source-dirs: lib
10+
default-language: Haskell2010
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module B where
2+
3+
foo :: Int -> Int
4+
foo = id
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# cabal build
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- A-0.1.0.0 (lib) (first run)
6+
- A-0.1.0.0 (exe:A) (first run)
7+
- B-0.1.0.0 (lib) (first run)
8+
- A-0.1.0.0 (test:A-tests) (first run)
9+
Configuring library for A-0.1.0.0..
10+
Preprocessing library for A-0.1.0.0..
11+
Building library for A-0.1.0.0..
12+
Configuring executable 'A' for A-0.1.0.0..
13+
Preprocessing executable 'A' for A-0.1.0.0..
14+
Building executable 'A' for A-0.1.0.0..
15+
Configuring library for B-0.1.0.0..
16+
Preprocessing library for B-0.1.0.0..
17+
Building library for B-0.1.0.0..
18+
Configuring test suite 'A-tests' for A-0.1.0.0..
19+
Warning: The package has an extraneous version range for a dependency on an internal library: A >=0 && ==0.1.0.0. This version range includes the current package but isn't needed as the current package's library will always be used.
20+
Preprocessing test suite 'A-tests' for A-0.1.0.0..
21+
Building test suite 'A-tests' for A-0.1.0.0..
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
import Test.Cabal.Prelude
3+
import Test.Cabal.DecodeShowBuildInfo
4+
5+
main = cabalTest $ do
6+
runShowBuildInfo ["all", "--enable-tests"]
7+
withPlan $ do
8+
assertComponent "A" (exe "A")
9+
defCompAssertion
10+
{ sourceFiles = ["Main.hs"]
11+
, sourceDirs = ["src"]
12+
}
13+
assertComponent "A" mainLib
14+
defCompAssertion
15+
{ modules = ["A"]
16+
, sourceDirs = ["src"]
17+
}
18+
19+
assertComponent "B" mainLib
20+
defCompAssertion
21+
{ modules = ["B"]
22+
, sourceDirs = ["lib"]
23+
}
24+
assertComponent "A" (test "A-tests")
25+
defCompAssertion
26+
{ sourceFiles = ["Test.hs"]
27+
, sourceDirs = ["src"]
28+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# cabal build
2+
Resolving dependencies...
3+
Build profile: -w ghc-<GHCVER> -O1
4+
In order, the following will be built:
5+
- A-0.1.0.0 (exe:A) (first run)
6+
Configuring executable 'A' for A-0.1.0.0..
7+
Preprocessing executable 'A' for A-0.1.0.0..
8+
Building executable 'A' for A-0.1.0.0..
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
import Test.Cabal.Prelude
3+
import Test.Cabal.DecodeShowBuildInfo
4+
5+
main = cabalTest $ do
6+
runShowBuildInfo ["exe:A"]
7+
withPlan $ do
8+
assertComponent "A" (exe "A")
9+
defCompAssertion
10+
{ sourceFiles = ["Main.hs"]
11+
, sourceDirs = ["src"]
12+
-- does not list lib as a target
13+
, compilerArgsPred = all (/= "A-0.1.0.0-inplace")
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: . ./B/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module A where
2+
3+
foo = 2

0 commit comments

Comments
 (0)