Skip to content

Commit 6bef1c7

Browse files
committed
Re-design test-cases for show-build-info
1 parent 8ce27f2 commit 6bef1c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+415
-385
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

cabal-testsuite/PackageTests/ShowBuildInfo/A/A.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ executable A
1818
test-suite A-tests
1919
type: exitcode-stdio-1.0
2020
main-is: Test.hs
21-
build-depends: base >=4
21+
build-depends: base >=4, A
2222
hs-source-dirs: src
2323
default-language: Haskell2010

cabal-testsuite/PackageTests/ShowBuildInfo/B/B.cabal renamed to cabal-testsuite/PackageTests/ShowBuildInfo/A/B/B.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 0.1.0.0
44
license: BSD-3-Clause
55

66
library
7-
exposed-modules: A
7+
exposed-modules: B
88
build-depends: base >=4.0.0.0, A
9-
hs-source-dirs: src
9+
hs-source-dirs: lib
1010
default-language: Haskell2010
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module A where
1+
module B where
22

33
foo :: Int -> Int
44
foo = id

cabal-testsuite/PackageTests/ShowBuildInfo/A/Setup.hs

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Test.Cabal.Prelude
2+
import Test.Cabal.DecodeShowBuildInfo
3+
4+
main = cabalTest $ do
5+
buildInfo <- runShowBuildInfo ["lib:B"]
6+
assertCommonBuildInfo buildInfo
7+
assertEqual "Number of Components" 1 (length $ components buildInfo)
8+
let [libComp] = components buildInfo
9+
assertLibComponent libComp "lib" ["B"] ["lib"]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Test.Cabal.Prelude
2+
import Test.Cabal.DecodeShowBuildInfo
3+
4+
main = cabalTest $ do
5+
buildInfo <- runShowBuildInfo ["lib:B", "lib:A"]
6+
assertCommonBuildInfo buildInfo
7+
assertEqual "Number of Components" 2 (length $ components buildInfo)
8+
let [libAComp, libBComp] = components buildInfo
9+
assertLibComponent libAComp "lib" ["A"] ["src"]
10+
assertLibComponent libBComp "lib" ["B"] ["lib"]

cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-all.test.hs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import Test.Cabal.Prelude
22
import Test.Cabal.DecodeShowBuildInfo
33

44
main = cabalTest $ do
5-
buildInfo <- runShowBuildInfo ["-v0"] -- hide verbose output so we can parse
6-
let comps = components buildInfo
7-
assertEqual "Components, exactly three" 3 (length comps)
8-
assertEqual "Test components, exactly one" 1 $
9-
length $ filter (\c -> "test" == componentType c) comps
5+
buildInfo <- runShowBuildInfo ["all", "--enable-tests"]
6+
assertCommonBuildInfo buildInfo
7+
assertEqual "Number of Components" 4 (length $ components buildInfo)
8+
let [libAComp, exeComp, testComp, libBComp] = components buildInfo
9+
assertExeComponent exeComp "exe:A" ["Main.hs"] ["src"]
10+
assertLibComponent libAComp "lib" ["A"] ["src"]
11+
assertLibComponent libBComp "lib" ["B"] ["lib"]
12+
assertTestComponent testComp "test:A-tests" ["Test.hs"] ["src"]

0 commit comments

Comments
 (0)