-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-design test-cases for show-build-info
- Loading branch information
Showing
68 changed files
with
415 additions
and
385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ite/PackageTests/ShowBuildInfo/B/src/A.hs → ...e/PackageTests/ShowBuildInfo/A/B/lib/A.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module A where | ||
module B where | ||
|
||
foo :: Int -> Int | ||
foo = id |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-B-lib.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ do | ||
buildInfo <- runShowBuildInfo ["lib:B"] | ||
assertCommonBuildInfo buildInfo | ||
assertEqual "Number of Components" 1 (length $ components buildInfo) | ||
let [libComp] = components buildInfo | ||
assertLibComponent libComp "lib" ["B"] ["lib"] |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-B-outer-lib.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ do | ||
buildInfo <- runShowBuildInfo ["lib:B", "lib:A"] | ||
assertCommonBuildInfo buildInfo | ||
assertEqual "Number of Components" 2 (length $ components buildInfo) | ||
let [libAComp, libBComp] = components buildInfo | ||
assertLibComponent libAComp "lib" ["A"] ["src"] | ||
assertLibComponent libBComp "lib" ["B"] ["lib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-exe-exact.test.hs
This file was deleted.
Oops, something went wrong.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-exe.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ do | ||
buildInfo <- runShowBuildInfo ["exe:A"] | ||
assertCommonBuildInfo buildInfo | ||
assertEqual "Number of Components" 1 (length $ components buildInfo) | ||
let [exeComp] = components buildInfo | ||
assertExeComponent exeComp "exe:A" ["Main.hs"] ["src"] | ||
|
||
-- Must not have library as a dependency as "exe:A" does not depend on it. | ||
assertBool "Does not contain library as dependency" | ||
(all (/= "A-0.1.0.0-inplace") $ componentCompilerArgs exeComp) |
36 changes: 0 additions & 36 deletions
36
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-multiple-exact-unit-id-file.test.hs
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-multiple-exact-unit-id.test.hs
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-multiple-exact.test.hs
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-multiple-targets-file.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# cabal show-build-info | ||
Resolving dependencies... | ||
Configuring library for A-0.1.0.0.. | ||
Configuring executable 'A' for A-0.1.0.0.. |
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-multiple-targets-file.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ withSourceCopy $ do | ||
cwd <- fmap testCurrentDir getTestEnv | ||
let fp = cwd </> "unit.json" | ||
_ <- cabal' "show-build-info" ["--buildinfo-json-output=" ++ fp, "exe:A", "lib:A"] | ||
buildInfo <- decodeBuildInfoFile fp | ||
assertCommonBuildInfo buildInfo | ||
assertEqual "Number of Components" 2 (length $ components buildInfo) | ||
let [libBuildInfo, exeBuildInfo] = components buildInfo | ||
assertExeComponent exeBuildInfo "exe:A" ["Main.hs"] ["src"] | ||
assertLibComponent libBuildInfo "lib" ["A"] ["src"] |
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-multiple-targets.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ do | ||
buildInfo <- runShowBuildInfo ["exe:A", "lib:A"] | ||
assertCommonBuildInfo buildInfo | ||
let [libBuildInfo, exeBuildInfo] = components buildInfo | ||
assertExeComponent exeBuildInfo "exe:A" ["Main.hs"] ["src"] | ||
assertLibComponent libBuildInfo "lib" ["A"] ["src"] |
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-no-target.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ do | ||
buildInfo <- runShowBuildInfo [] | ||
assertCommonBuildInfo buildInfo | ||
let comps = components buildInfo | ||
assertEqual "Number of Components" 2 (length comps) | ||
assertBool "Contains main component executable" | ||
(any (\c -> "exe:A" == componentName c) comps) | ||
assertBool "Contains main component library" | ||
(any (\c -> "lib" == componentName c) comps) |
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-test.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Test.Cabal.Prelude | ||
import Test.Cabal.DecodeShowBuildInfo | ||
|
||
main = cabalTest $ do | ||
buildInfo <- runShowBuildInfo ["test:A-tests"] | ||
assertCommonBuildInfo buildInfo | ||
assertEqual "Number of Components" 1 (length $ components buildInfo) | ||
let [testComp] = components buildInfo | ||
assertTestComponent testComp "test:A-tests" ["Test.hs"] ["src"] | ||
|
||
-- Must have library as a dependency as "test:A-tests" depends on it. | ||
assertBool "Contains internal dependency" | ||
(any (== "A-0.1.0.0-inplace") $ componentCompilerArgs testComp) |
7 changes: 0 additions & 7 deletions
7
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-unknown.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
# cabal show-build-info | ||
cabal: Internal error in target matching. It should always be possible to find a syntax that's sufficiently qualified to give an unambiguous match. However when matching 'exe:B' we found exe:B (unknown-component) which does not have an unambiguous syntax. The possible syntax and the targets they match are as follows: | ||
'exe:B' which matches exe:B (unknown-component), :pkg:exe:lib:exe:module:B (unknown-module), :pkg:exe:lib:exe:file:B (unknown-file) | ||
# cabal show-build-info | ||
Resolving dependencies... | ||
cabal: No unit B-inplace-0.1.0.0 | ||
# cabal show-build-info | ||
cabal: No unit B-inplace-0.1.0.0 | ||
# cabal show-build-info | ||
cabal: Internal error in target matching. It should always be possible to find a syntax that's sufficiently qualified to give an unambiguous match. However when matching 'exe:B' we found exe:B (unknown-component) which does not have an unambiguous syntax. The possible syntax and the targets they match are as follows: | ||
'exe:B' which matches exe:B (unknown-component), :pkg:exe:lib:exe:module:B (unknown-module), :pkg:exe:lib:exe:file:B (unknown-file) |
15 changes: 8 additions & 7 deletions
15
cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-unknown.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest $ do | ||
r <- fails $ cabal' "show-build-info" ["exe:B"] | ||
r <- fails $ cabal' "show-build-info" ["exe:B", "-v1"] | ||
assertOutputContains "Internal error in target matching." r | ||
|
||
r <- fails $ cabal' "show-build-info" ["--unit-ids-json=B-inplace-0.1.0.0"] | ||
assertOutputContains "No unit B-inplace-0.1.0.0" r | ||
r <- fails $ cabal' "show-build-info" ["C", "-v1"] | ||
assertOutputContains "Cannot show-build-info the package C, it is not in this project (either directly or indirectly)." r | ||
|
||
r <- fails $ cabal' "show-build-info" ["--unit-ids-json=A-0.1.0.0-inplace B-inplace-0.1.0.0"] | ||
assertOutputContains "No unit B-inplace-0.1.0.0" r | ||
|
||
r <- fails $ cabal' "show-build-info" ["--unit-ids-json=A-0.1.0.0-inplace", "exe:B"] | ||
r <- fails $ cabal' "show-build-info" ["lib:C", "-v1"] | ||
assertOutputContains "Internal error in target matching." r | ||
|
||
r <- fails $ cabal' "show-build-info" ["benchmarks", "-v1"] | ||
assertOutputContains "Cannot show-build-info the benchmarks in the package A-0.1.0.0 because it does not contain any benchmarks." r | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
packages: . | ||
packages: . ./B/ |
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
cabal-testsuite/PackageTests/ShowBuildInfo/B/build-info-lib-exact.test.hs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
cabal-testsuite/PackageTests/ShowBuildInfo/C/build-info-all-internal-deps.test.hs
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.