-
Notifications
You must be signed in to change notification settings - Fork 400
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: opam constraint generation (#7729)
This generalizes the test for #3431 and actually reveals that nested ors are incorrectly translated at the moment: in `p_or3`, `(or :a :b :c)` gets converted to `{a | b & c}`. It also adds a test for `(and)` and `(or)` with no argument, which should fail cleanly. Signed-off-by: Etienne Millon <me@emillon.org>
- Loading branch information
Showing
2 changed files
with
95 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,95 @@ | ||
This tests the dune-project -> opam file generation with different kinds of | ||
constraints. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 2.1) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> ; unary ops | ||
> (p_eq (= v)) | ||
> (p_lt (< v)) | ||
> (p_gt (> v)) | ||
> (p_ge (>= v)) | ||
> (p_le (<= v)) | ||
> (p_ne (<> v)) | ||
> ; binary ops | ||
> (p_bin (<> :os win32)) | ||
> ; and | ||
> (p_and2 (and :a :b)) | ||
> (p_and1 (and :a)) | ||
> (p_and3 (and :a :b :c)) | ||
> ; or | ||
> (p_or2 (or :a :b)) | ||
> (p_or1 (or :a)) | ||
> (p_or3 (or :a :b :c)) ; buggy output | ||
> ; mixed operations | ||
> (p_and_in_or (or :a (and :b :c))) ; buggy output, see #3431 | ||
> (p_or_in_and (and :a (or :b :c))) | ||
> )) | ||
> EOF | ||
|
||
$ dune build | ||
|
||
$ cat p.opam | ||
# This file is generated by dune, edit dune-project instead | ||
opam-version: "2.0" | ||
depends: [ | ||
"dune" {>= "2.1"} | ||
"p_eq" {= "v"} | ||
"p_lt" {< "v"} | ||
"p_gt" {> "v"} | ||
"p_ge" {>= "v"} | ||
"p_le" {<= "v"} | ||
"p_ne" {!= "v"} | ||
"p_bin" {os != "win32"} | ||
"p_and2" {a & b} | ||
"p_and1" {a} | ||
"p_and3" {a & b & c} | ||
"p_or2" {a | b} | ||
"p_or1" {a} | ||
"p_or3" {a | b & c} | ||
"p_and_in_or" {a | b & c} | ||
"p_or_in_and" {a & b | c} | ||
] | ||
build: [ | ||
["dune" "subst"] {pinned} | ||
[ | ||
"dune" | ||
"build" | ||
"-p" | ||
name | ||
"-j" | ||
jobs | ||
"@install" | ||
"@runtest" {with-test} | ||
"@doc" {with-doc} | ||
] | ||
] | ||
|
||
`(and)`/`(or)` with no argument should get rejected. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 2.1) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> (p (and)))) | ||
> EOF | ||
|
||
$ dune build 2>&1 | grep 'Internal error' | ||
Internal error, please report upstream including the contents of _build/log. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 2.1) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> (p (or)))) | ||
> EOF | ||
|
||
$ dune build 2>&1 | grep 'Internal error' | ||
Internal error, please report upstream including the contents of _build/log. |