-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(opam): cleanly reject argumentless (and)/(or)
Otherwise they would raise a code error later. Signed-off-by: Etienne Millon <me@emillon.org>
- Loading branch information
Showing
4 changed files
with
116 additions
and
29 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
97 changes: 97 additions & 0 deletions
97
test/blackbox-tests/test-cases/opam-constraints-and-or-no-args.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,97 @@ | ||
`(and)`/`(or)` with no argument should get rejected. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.9) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> (p (and)))) | ||
> EOF | ||
|
||
$ dune build | ||
File "dune-project", line 6, characters 5-10: | ||
6 | (p (and)))) | ||
^^^^^ | ||
Error: Logical operators with no arguments was deleted in version 3.9 of the | ||
dune language. | ||
[1] | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.9) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> (p (or)))) | ||
> EOF | ||
|
||
$ dune build | ||
File "dune-project", line 6, characters 5-9: | ||
6 | (p (or)))) | ||
^^^^ | ||
Error: Logical operators with no arguments was deleted in version 3.9 of the | ||
dune language. | ||
[1] | ||
|
||
In < 3.9 they are accepted, assuming they are not used to generate opam files. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.8) | ||
> (package | ||
> (name p) | ||
> (allow_empty) | ||
> (depends | ||
> (p (and)))) | ||
> EOF | ||
|
||
$ dune build | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.8) | ||
> (package | ||
> (name p) | ||
> (allow_empty) | ||
> (depends | ||
> (p (or)))) | ||
> EOF | ||
|
||
$ dune build | ||
|
||
Generating opam files should trigger a (nice) error: | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.8) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> (p (and)))) | ||
> EOF | ||
|
||
$ dune build | ||
Error: logical operations with no arguments are not supported | ||
-> required by _build/default/p.opam | ||
-> required by _build/install/default/lib/p/opam | ||
-> required by _build/default/p.install | ||
-> required by alias all | ||
-> required by alias default | ||
[1] | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.8) | ||
> (generate_opam_files) | ||
> (package | ||
> (name p) | ||
> (depends | ||
> (p (or)))) | ||
> EOF | ||
|
||
$ dune build | ||
Error: logical operations with no arguments are not supported | ||
-> required by _build/default/p.opam | ||
-> required by _build/install/default/lib/p/opam | ||
-> required by _build/default/p.install | ||
-> required by alias all | ||
-> required by alias default | ||
[1] |
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