Skip to content

Commit 24996ba

Browse files
committed
Add tests for -any and -none
1 parent 7f8d11b commit 24996ba

5 files changed

Lines changed: 79 additions & 3 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# tar
2+
# tar
3+
# tar
4+
# cabal v2-update
5+
Downloading the latest package list from test-local-repo
6+
# cabal v2-build
7+
Resolving dependencies...
8+
Error: [Cabal-7107]
9+
Could not resolve dependencies:
10+
[__0] trying: a-0 (user goal)
11+
[__1] next goal: some-lib (dependency of a)
12+
[__1] fail (not a user-provided goal nor mentioned as a constraint, but reject-unconstrained-dependencies was set)
13+
[__1] fail (backjumping, conflict set: a, some-lib)
14+
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: a (2), some-lib (1)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# tar
2+
# tar
3+
# tar
4+
# cabal v2-update
5+
Downloading the latest package list from test-local-repo
6+
# cabal v2-build
7+
Resolving dependencies...
8+
Error: [Cabal-7107]
9+
Could not resolve dependencies:
10+
[__0] trying: a-0 (user goal)
11+
[__1] next goal: some-lib (dependency of a)
12+
[__1] fail (not a user-provided goal nor mentioned as a constraint, but reject-unconstrained-dependencies was set)
13+
[__1] fail (backjumping, conflict set: a, some-lib)
14+
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: a (2), some-lib (1)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# tar
2+
# tar
3+
# tar
4+
# cabal v2-update
5+
Downloading the latest package list from test-local-repo
6+
# cabal v2-build
7+
Resolving dependencies...
8+
Build profile: -w ghc-<GHCVER> -O1
9+
In order, the following would be built:
10+
- some-lib-1.0 (lib) (requires build)
11+
- a-0 (lib) (first run)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# tar
2+
# tar
3+
# tar
4+
# cabal v2-update
5+
Downloading the latest package list from test-local-repo
6+
# cabal v2-build
7+
Resolving dependencies...
8+
Error: [Cabal-7107]
9+
Could not resolve dependencies:
10+
[__0] trying: a-0 (user goal)
11+
[__1] next goal: some-lib (dependency of a)
12+
[__1] rejecting: some-lib-1.0 (constraint from command line flag requires <0)
13+
[__1] fail (backjumping, conflict set: a, some-lib)
14+
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: a (2), some-lib (2)
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
import Test.Cabal.Prelude
2-
main = cabalTest . recordMode RecordMarked $ withRepo "repo" $ do
3-
res <- fails $ cabal' "v2-build" ["all", "--dry-run"]
4-
assertOutputContains "not a user-provided goal" res
2+
main = do
3+
cabalTest . recordMode RecordMarked $ withRepo "repo" $ do
4+
res <- fails $ cabal' "v2-build" ["all", "--dry-run"]
5+
assertOutputContains "not a user-provided goal" res
6+
7+
-- Not really a version constrained dependency.
8+
cabalTest' "any-flag" . recordMode RecordMarked $ withRepo "repo" $ do
9+
res <- fails $ cabal' "v2-build" ["all", "--dry-run", "--constraint", "some-lib -any"]
10+
assertOutputContains "not a user-provided goal" res
11+
12+
-- Not really a version constrained dependency.
13+
cabalTest' "any-version" . recordMode RecordMarked $ withRepo "repo" $ do
14+
res <- fails $ cabal' "v2-build" ["all", "--dry-run", "--constraint", "some-lib >=0"]
15+
assertOutputContains "not a user-provided goal" res
16+
17+
-- TODO: Find out why isn't -none the same as <0?
18+
cabalTest' "none-flag" . recordMode RecordMarked $ withRepo "repo" $ do
19+
res <- cabal' "v2-build" ["all", "--dry-run", "--constraint", "some-lib -none"]
20+
assertOutputDoesNotContain "not a user-provided goal" res
21+
22+
-- Doesn't get as far as the constraint check because the <0 version
23+
-- constraint is unsatisfiable and the dependency is rejected.
24+
cabalTest' "none-version" . recordMode RecordMarked $ withRepo "repo" $ do
25+
res <- fails $ cabal' "v2-build" ["all", "--dry-run", "--constraint", "some-lib <0"]
26+
assertOutputContains " rejecting: some-lib-1.0 (constraint from command line flag requires <0)" res
27+
assertOutputDoesNotContain "not a user-provided goal" res

0 commit comments

Comments
 (0)