-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86ba28c
commit 02ae26b
Showing
7 changed files
with
226 additions
and
8 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
Create a simple dune project: for testing opam-dune-lint, if dune constraint matches | ||
the dune-project file | ||
|
||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 2.7) | ||
> (package | ||
> (name test) | ||
> (synopsis "Test package")) | ||
> EOF | ||
|
||
$ cat > test.opam << EOF | ||
> # Preserve comments | ||
> opam-version: "2.0" | ||
> synopsis: "Test package" | ||
> build: [ | ||
> ["dune" "build"] | ||
> ] | ||
> depends: [ | ||
> "ocamlfind" {>= "1.0"} | ||
> "libfoo" | ||
> ] | ||
> EOF | ||
|
||
$ cat > dune << EOF | ||
> (executable | ||
> (name main) | ||
> (public_name main) | ||
> (modules main) | ||
> (libraries findlib fmt)) | ||
> (test | ||
> (name test) | ||
> (modules test) | ||
> (libraries bos opam-state)) | ||
> EOF | ||
|
||
$ touch main.ml test.ml | ||
$ dune build | ||
|
||
Replace all version numbers with "1.0" to get predictable output. | ||
|
||
$ export OPAM_DUNE_LINT_TESTS=y | ||
|
||
Check that the missing libraries get added: | ||
|
||
$ opam-dune-lint -f | ||
test.opam: changes needed: | ||
"fmt" {>= "1.0"} [from /] | ||
"bos" {with-test & >= "1.0"} [from /] | ||
"opam-state" {with-test & >= "1.0"} [from /] | ||
Note: version numbers are just suggestions based on the currently installed version. | ||
Wrote "./test.opam" | ||
Warning in test: The package has a dune-project file but no explicit dependency on dune was found. | ||
|
||
$ cat test.opam | sed 's/= [^&)}]*/= */g' | ||
# Preserve comments | ||
opam-version: "2.0" | ||
synopsis: "Test package" | ||
build: [ | ||
["dune" "build"] | ||
] | ||
depends: [ | ||
"ocamlfind" {>= *} | ||
"libfoo" | ||
"fmt" {>= *} | ||
"bos" {>= *& with-test} | ||
"opam-state" {>= *& with-test} | ||
] | ||
|
||
$ cat > test.opam << EOF | ||
> # Preserve comments | ||
> opam-version: "2.0" | ||
> synopsis: "Test package" | ||
> build: [ | ||
> ["dune" "build"] | ||
> ] | ||
> depends: [ | ||
> "ocamlfind" {>= "1.0"} | ||
> "libfoo" | ||
> "dune" {> "2.7" & build} | ||
> ] | ||
> EOF | ||
$ dune build | ||
|
||
Check that the missing libraries get added: | ||
|
||
$ opam-dune-lint -f | ||
test.opam: changes needed: | ||
"fmt" {>= "1.0"} [from /] | ||
"bos" {with-test & >= "1.0"} [from /] | ||
"opam-state" {with-test & >= "1.0"} [from /] | ||
Note: version numbers are just suggestions based on the currently installed version. | ||
Wrote "./test.opam" | ||
Warning in test: The package tagged dune as a build dependency. Due to a bug in dune (https://github.com/ocaml/dune/issues/2147) this should never be the case. Please remove the {build} tag from its filter. | ||
|
||
$ cat > test.opam << EOF | ||
> # Preserve comments | ||
> opam-version: "2.0" | ||
> synopsis: "Test package" | ||
> build: [ | ||
> ["dune" "build"] | ||
> ] | ||
> depends: [ | ||
> "ocamlfind" {>= "1.0"} | ||
> "libfoo" | ||
> "dune" {> "1.0" & build} | ||
> ] | ||
> EOF | ||
$ dune build | ||
|
||
Check that the missing libraries get added: | ||
|
||
$ opam-dune-lint -f | ||
test.opam: changes needed: | ||
"fmt" {>= "1.0"} [from /] | ||
"bos" {with-test & >= "1.0"} [from /] | ||
"opam-state" {with-test & >= "1.0"} [from /] | ||
Note: version numbers are just suggestions based on the currently installed version. | ||
Wrote "./test.opam" | ||
Warning in test: The package tagged dune as a build dependency. Due to a bug in dune (https://github.com/ocaml/dune/issues/2147) this should never be the case. Please remove the {build} tag from its filter. | ||
Error in test: Your dune-project file indicates that this package requires at least dune 2.7 but your opam file only requires dune >= 1.0. Please check which requirement is the right one, and fix the other. | ||
[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
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,92 @@ | ||
Create a simple dune project: testing if opam-dune-lint update opam files | ||
using the dune-project file, before the linting process. | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 2.7) | ||
> (generate_opam_files true) | ||
> (package | ||
> (name test) | ||
> (synopsis "Test package") | ||
> (depends cmdliner)) | ||
> EOF | ||
|
||
$ cat > dune << EOF | ||
> (executable | ||
> (name main) | ||
> (public_name main) | ||
> (modules main) | ||
> (libraries findlib fmt)) | ||
> (test | ||
> (name test) | ||
> (modules test) | ||
> (libraries bos opam-state)) | ||
> EOF | ||
|
||
$ touch main.ml test.ml | ||
$ dune build | ||
$ cat test.opam | ||
# This file is generated by dune, edit dune-project instead | ||
opam-version: "2.0" | ||
synopsis: "Test package" | ||
depends: [ | ||
"dune" {>= "2.7"} | ||
"cmdliner" | ||
"odoc" {with-doc} | ||
] | ||
build: [ | ||
["dune" "subst"] {dev} | ||
[ | ||
"dune" | ||
"build" | ||
"-p" | ||
name | ||
"-j" | ||
jobs | ||
"@install" | ||
"@runtest" {with-test} | ||
"@doc" {with-doc} | ||
] | ||
] | ||
|
||
Replace all version numbers with "1.0" to get predictable output. | ||
|
||
$ export OPAM_DUNE_LINT_TESTS=y | ||
|
||
Check that the missing libraries get added: | ||
|
||
$ opam-dune-lint -f | ||
test.opam: changes needed: | ||
"fmt" {>= "1.0"} [from /] | ||
"ocamlfind" {>= "1.0"} [from /] | ||
"bos" {with-test & >= "1.0"} [from /] | ||
"opam-state" {with-test & >= "1.0"} [from /] | ||
Note: version numbers are just suggestions based on the currently installed version. | ||
Wrote "dune-project" | ||
|
||
$ cat test.opam | sed 's/= [^&)}]*/= */g' | ||
# This file is generated by dune, edit dune-project instead | ||
opam-version: "2.0" | ||
synopsis: "Test package" | ||
depends: [ | ||
"dune" {>= *} | ||
"opam-state" {>= *& with-test} | ||
"bos" {>= *& with-test} | ||
"ocamlfind" {>= *} | ||
"fmt" {>= *} | ||
"cmdliner" | ||
"odoc" {with-doc} | ||
] | ||
build: [ | ||
["dune" "subst"] {dev} | ||
[ | ||
"dune" | ||
"build" | ||
"-p" | ||
name | ||
"-j" | ||
jobs | ||
"@install" | ||
"@runtest" {with-test} | ||
"@doc" {with-doc} | ||
] | ||
] |