From ecefa1e6328de48ff73089a96f74cd8ce9769531 Mon Sep 17 00:00:00 2001 From: Lucas Pluvinage Date: Mon, 1 Apr 2019 12:21:44 +0200 Subject: [PATCH] Add a test that covers the error Signed-off-by: Lucas Pluvinage --- test/blackbox-tests/test-cases/variants/run.t | 6 +++++- .../test-cases/variants/same-lib-in-multiple-scopes/dune | 9 +++++++++ .../variants/same-lib-in-multiple-scopes/dune-project | 1 + .../variants/same-lib-in-multiple-scopes/exe.ml | 0 .../same-lib-in-multiple-scopes/test/dune-project | 1 + .../same-lib-in-multiple-scopes/test/test-unix.opam | 0 .../variants/same-lib-in-multiple-scopes/test/test.opam | 0 .../variants/same-lib-in-multiple-scopes/test/unix/dune | 5 +++++ .../same-lib-in-multiple-scopes/test/unix/foo.ml | 0 .../variants/same-lib-in-multiple-scopes/test/virt/dune | 4 ++++ .../same-lib-in-multiple-scopes/test/virt/foo.mli | 0 11 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune-project create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/exe.ml create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/dune-project create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/test-unix.opam create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/test.opam create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/dune create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/foo.ml create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/dune create mode 100644 test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/foo.mli diff --git a/test/blackbox-tests/test-cases/variants/run.t b/test/blackbox-tests/test-cases/variants/run.t index 2171b44000a9..618877a9e163 100644 --- a/test/blackbox-tests/test-cases/variants/run.t +++ b/test/blackbox-tests/test-cases/variants/run.t @@ -17,8 +17,8 @@ variants results in an appropriate error message. ^^^^^^^ Error: Multiple solutions for the implementation of vlib with variants [ "default" ] - -> lib2_default ("default") -> lib_default ("default") + -> lib2_default ("default") -> required by executable bar in dune:2 [1] @@ -78,3 +78,7 @@ Solving variant ambiguity by specifying a concrete implementation. Entering directory 'variant-with-concrete-impl' bar alias default hello from lib2.default + +Don't fail when the same library is defined in multiple scopes. + $ dune build --root same-lib-in-multiple-scopes + Entering directory 'same-lib-in-multiple-scopes' diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune new file mode 100644 index 000000000000..4b37b50c7907 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune @@ -0,0 +1,9 @@ +(executable + (name exe) + (variants unix) + (libraries test)) + +(alias + (name default) + (action + (run ./exe.exe))) diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune-project b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune-project new file mode 100644 index 000000000000..ec8c49b51b8d --- /dev/null +++ b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/dune-project @@ -0,0 +1 @@ +(lang dune 1.9) \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/exe.ml b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/exe.ml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/dune-project b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/dune-project new file mode 100644 index 000000000000..ec8c49b51b8d --- /dev/null +++ b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/dune-project @@ -0,0 +1 @@ +(lang dune 1.9) \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/test-unix.opam b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/test-unix.opam new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/test.opam b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/test.opam new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/dune b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/dune new file mode 100644 index 000000000000..c2de3e42a6f8 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/dune @@ -0,0 +1,5 @@ +(library + (name test_unix) + (public_name test-unix) + (implements test) + (variant unix)) diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/foo.ml b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/unix/foo.ml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/dune b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/dune new file mode 100644 index 000000000000..155ccdb47b1d --- /dev/null +++ b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/dune @@ -0,0 +1,4 @@ +(library + (name test) + (public_name test) + (virtual_modules foo)) diff --git a/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/foo.mli b/test/blackbox-tests/test-cases/variants/same-lib-in-multiple-scopes/test/virt/foo.mli new file mode 100644 index 000000000000..e69de29bb2d1