-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: eif, add collision tests for exes and melange.emit (#10211)
* eif: add collision tests for exes and melange.emit
- Loading branch information
Showing
4 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
test/blackbox-tests/test-cases/enabled_if/eif-exe-name-collision-same-folder.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,35 @@ | ||
Using same executable name in two contexts, where the executables are defined | ||
in the same dune file | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.13) | ||
> EOF | ||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.13) | ||
> | ||
> (context default) | ||
> | ||
> (context | ||
> (default | ||
> (name alt-context))) | ||
> EOF | ||
$ cat > dune << EOF | ||
> (executable | ||
> (name foo) | ||
> (enabled_if (= %{context_name} "default"))) | ||
> (executable | ||
> (name foo) | ||
> (enabled_if (= %{context_name} "alt-context"))) | ||
> EOF | ||
$ cat > foo.ml <<EOF | ||
> let () = print_endline "foo" | ||
> EOF | ||
$ dune build | ||
File "dune", line 4, characters 0-72: | ||
4 | (executable | ||
5 | (name foo) | ||
6 | (enabled_if (= %{context_name} "alt-context"))) | ||
Error: Executable "foo" appears for the second time in this directory | ||
[1] |
35 changes: 35 additions & 0 deletions
35
test/blackbox-tests/test-cases/enabled_if/eif-exe-name-collision.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,35 @@ | ||
Using same executable name in two contexts | ||
|
||
$ mkdir -p a b | ||
$ cat > dune-project << EOF | ||
> (lang dune 3.13) | ||
> EOF | ||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.13) | ||
> | ||
> (context default) | ||
> | ||
> (context | ||
> (default | ||
> (name alt-context))) | ||
> EOF | ||
$ cat > a/dune << EOF | ||
> (executable | ||
> (name foo) | ||
> (enabled_if (= %{context_name} "default"))) | ||
> EOF | ||
$ cat > a/foo.ml <<EOF | ||
> let () = print_endline "foo" | ||
> EOF | ||
$ cat > b/dune << EOF | ||
> (executable | ||
> (name foo) | ||
> (enabled_if (= %{context_name} "alt-context"))) | ||
> EOF | ||
$ cat > b/foo.ml <<EOF | ||
> let () = print_endline "foo" | ||
> EOF | ||
$ dune build |
36 changes: 36 additions & 0 deletions
36
test/blackbox-tests/test-cases/enabled_if/eif-melange-emit-name-collision-same-folder.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,36 @@ | ||
Using same melange.emit target in two contexts, where the stanzas are defined | ||
in the same dune file | ||
|
||
$ cat > dune-project << EOF | ||
> (lang dune 3.13) | ||
> (using melange 0.1) | ||
> EOF | ||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.13) | ||
> | ||
> (context default) | ||
> | ||
> (context | ||
> (default | ||
> (name alt-context))) | ||
> EOF | ||
$ cat > dune << EOF | ||
> (melange.emit | ||
> (target foo) | ||
> (enabled_if (= %{context_name} "default"))) | ||
> (melange.emit | ||
> (target foo) | ||
> (enabled_if (= %{context_name} "alt-context"))) | ||
> EOF | ||
$ cat > foo.ml <<EOF | ||
> let () = print_endline "foo" | ||
> EOF | ||
$ dune build | ||
File "dune", line 4, characters 0-76: | ||
4 | (melange.emit | ||
5 | (target foo) | ||
6 | (enabled_if (= %{context_name} "alt-context"))) | ||
Error: Target "foo" appears for the second time in this directory | ||
[1] |
36 changes: 36 additions & 0 deletions
36
test/blackbox-tests/test-cases/enabled_if/eif-melange-emit-name-collision.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,36 @@ | ||
Using same melange.emit target in two contexts | ||
|
||
$ mkdir -p a b | ||
$ cat > dune-project << EOF | ||
> (lang dune 3.13) | ||
> (using melange 0.1) | ||
> EOF | ||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.13) | ||
> | ||
> (context default) | ||
> | ||
> (context | ||
> (default | ||
> (name alt-context))) | ||
> EOF | ||
$ cat > a/dune << EOF | ||
> (melange.emit | ||
> (target foo) | ||
> (enabled_if (= %{context_name} "default"))) | ||
> EOF | ||
$ cat > a/foo.ml <<EOF | ||
> let () = print_endline "foo" | ||
> EOF | ||
$ cat > b/dune << EOF | ||
> (melange.emit | ||
> (target foo) | ||
> (enabled_if (= %{context_name} "alt-context"))) | ||
> EOF | ||
$ cat > b/foo.ml <<EOF | ||
> let () = print_endline "foo" | ||
> EOF | ||
$ dune build |