Skip to content

Commit

Permalink
test: show that universal libraries can't share the public_name (#10471)
Browse files Browse the repository at this point in the history
* 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
anmonteiro committed May 18, 2024
1 parent de57dfc commit c2ea2fa
Showing 1 changed file with 65 additions and 0 deletions.
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]

0 comments on commit c2ea2fa

Please sign in to comment.