-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: show that universal libraries can't share the public_name (#10471)
* test: show that universal libraries can't share the public_name Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> * chore: describe the test a bit more clearly Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com> --------- Signed-off-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
- Loading branch information
1 parent
de57dfc
commit c2ea2fa
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
test/blackbox-tests/test-cases/enabled_if/eif-public-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,65 @@ | ||
Show that public library names can't be defined twice, even in different | ||
contexts | ||
$ mkdir -p a b | ||
$ cat > dune-workspace << EOF | ||
> (lang dune 3.13) | ||
> | ||
> (context default) | ||
> (context | ||
> (default | ||
> (name melange))) | ||
> EOF | ||
$ cat > dune-project << EOF | ||
> (lang dune 3.13) | ||
> (package (name foo) (allow_empty)) | ||
> EOF | ||
$ cat > a/dune << EOF | ||
> (library | ||
> (name libname) | ||
> (public_name foo.lib) | ||
> (enabled_if (= %{context_name} "default"))) | ||
> EOF | ||
$ cat > b/dune << EOF | ||
> (library | ||
> (name libname) | ||
> (public_name foo.lib) | ||
> (enabled_if (= %{context_name} "melange"))) | ||
> EOF | ||
Without any consumers of the libraries | ||
$ dune build | ||
File "b/dune", line 3, characters 14-21: | ||
3 | (public_name foo.lib) | ||
^^^^^^^ | ||
Error: Public library foo.lib is defined twice: | ||
- a/dune:3 | ||
- b/dune:3 | ||
[1] | ||
With some consumer | ||
$ cat > dune << EOF | ||
> (executable | ||
> (name main) | ||
> (libraries foo.lib) | ||
> (enabled_if (= %{context_name} "default"))) | ||
> EOF | ||
$ cat > main.ml <<EOF | ||
> let () = Foo.x | ||
> EOF | ||
$ dune build | ||
File "b/dune", line 3, characters 14-21: | ||
3 | (public_name foo.lib) | ||
^^^^^^^ | ||
Error: Public library foo.lib is defined twice: | ||
- a/dune:3 | ||
- b/dune:3 | ||
[1] | ||