Skip to content

Commit

Permalink
Implement basic test for new-show-build-info
Browse files Browse the repository at this point in the history
  • Loading branch information
fendor committed Apr 29, 2019
1 parent bb97784 commit dec0166
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cabal-testsuite/PackageTests/ShowBuildInfo/A/A.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ maintainer: [email protected]
extra-source-files: CHANGELOG.md

library
-- exposed-modules:
exposed-modules: A
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.12.0.0
build-depends: base >=4.0.0
hs-source-dirs: src
default-language: Haskell2010

executable A
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.12.0.0
build-depends: base >=4.0.0.0
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Test.Cabal.Prelude

main = cabalTest $ do
r <- cabal' "new-show-build-info" ["exe:A"]
assertOutputContains "\"cabal-version\":\"3.0.0.0\"" r
assertOutputContains "\"compiler\":{" r
assertOutputContains "\"flavour\":\"ghc\"" r
assertOutputContains "\"compiler-id\":" r
assertOutputContains "\"path\":" r
assertOutputContains "\"type\":\"exe\"" r
assertOutputContains "\"name\":\"exe:A\"" r
assertOutputContains "\"unit-id\":\"A-0.1.0.0-inplace-A\"" r
assertOutputContains "\"compiler-args\":[" r
assertOutputContains "\"modules\":[]" r
assertOutputContains "\"src-files\":[\"Main.hs\"]" r
assertOutputContains "\"src-dirs\":[\"src\"]" r

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Test.Cabal.Prelude

main = cabalTest $ do
r <- cabal' "new-show-build-info" ["lib:A"]
assertOutputContains "\"cabal-version\":\"3.0.0.0\"" r
assertOutputContains "\"compiler\":{" r
assertOutputContains "\"flavour\":\"ghc\"" r
assertOutputContains "\"compiler-id\":" r
assertOutputContains "\"path\":" r
assertOutputContains "\"type\":\"lib\"" r
assertOutputContains "\"name\":\"lib\"" r
assertOutputContains "\"unit-id\":\"A-0.1.0.0-inplace\"" r
assertOutputContains "\"compiler-args\":[" r
assertOutputContains "\"modules\":[\"A\"]" r
assertOutputContains "\"src-files\":[]" r
assertOutputContains "\"src-dirs\":[\"src\"]" r
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/ShowBuildInfo/A/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: .
4 changes: 2 additions & 2 deletions cabal-testsuite/PackageTests/ShowBuildInfo/B/B.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ maintainer: [email protected]
extra-source-files: CHANGELOG.md

library
-- exposed-modules:
exposed-modules: A
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.12.0.0
build-depends: base >=4.0.0.0
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Test.Cabal.Prelude

main = cabalTest $ do
r <- cabal' "new-show-build-info" ["lib:B"]
assertOutputContains "\"cabal-version\":\"3.0.0.0\"" r
assertOutputContains "\"compiler\":{" r
assertOutputContains "\"flavour\":\"ghc\"" r
assertOutputContains "\"compiler-id\":" r
assertOutputContains "\"path\":" r
assertOutputContains "\"type\":\"lib\"" r
assertOutputContains "\"name\":\"lib\"" r
assertOutputContains "\"unit-id\":\"B-0.1.0.0-inplace\"" r
assertOutputContains "\"compiler-args\":[" r
assertOutputContains "\"modules\":[\"A\"]" r
assertOutputContains "\"src-files\":[]" r
assertOutputContains "\"src-dirs\":[\"src\"]" r
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/ShowBuildInfo/B/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: .
7 changes: 0 additions & 7 deletions cabal-testsuite/PackageTests/ShowBuildInfo/cabal.test.hs

This file was deleted.

0 comments on commit dec0166

Please sign in to comment.