forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: depopts with constraints (ocaml#9434)
Signed-off-by: Ali Caglayan <alizter@gmail.com>
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
test/blackbox-tests/test-cases/pkg/depopts/depopts-with-constraints.t
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,39 @@ | ||
We test how the solver chooses a solution for depopts with constraints. | ||
|
||
$ . ../helpers.sh | ||
$ mkrepo | ||
|
||
We create a package "foo" that is the dependency of two packages "optional" and | ||
"bar". | ||
|
||
$ mkpkg foo 1 | ||
|
||
The package "optional" has a constraint on a particular version of "foo". | ||
|
||
$ mkpkg optional <<'EOF' | ||
> depends: [ "foo" {= "1"} ] | ||
> EOF | ||
The package "bar" depends on "foo" and depends optionally on "optional". | ||
$ mkpkg bar <<'EOF' | ||
> depends: [ "foo" ] | ||
> depopts: [ "optional" ] | ||
> EOF | ||
Here the solver could pick "bar" and "foo", and perphaps pick "optional", | ||
however this is not required. | ||
$ solve bar | ||
Solution for dune.lock: | ||
- bar.0.0.1 | ||
- foo.1 | ||
Since the version of "foo" is constrained by "optional", "optional" should be | ||
excluded from the build plan if the latest version of "foo" is picked. | ||
$ mkpkg foo 2 | ||
$ solve bar | ||
Solution for dune.lock: | ||
- bar.0.0.1 | ||
- foo.2 |