diff --git a/test/blackbox-tests/dune.inc b/test/blackbox-tests/dune.inc index ba32477858be..5f7c5704d62e 100644 --- a/test/blackbox-tests/dune.inc +++ b/test/blackbox-tests/dune.inc @@ -1490,6 +1490,16 @@ test-cases/variants-only-package (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) +(alias + (name variants-wrong-external-declaration) + (deps + (package dune) + (source_tree test-cases/variants-wrong-external-declaration)) + (action + (chdir + test-cases/variants-wrong-external-declaration + (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) + (alias (name vlib) (deps (package dune) (source_tree test-cases/vlib)) @@ -1506,6 +1516,14 @@ test-cases/vlib-default-impl (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) +(alias + (name vlib-wrong-default-impl) + (deps (package dune) (source_tree test-cases/vlib-wrong-default-impl)) + (action + (chdir + test-cases/vlib-wrong-default-impl + (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) + (alias (name windows-diff) (deps (package dune) (source_tree test-cases/windows-diff)) @@ -1721,8 +1739,10 @@ (alias variants-external-declaration-conflict) (alias variants-multi-project) (alias variants-only-package) + (alias variants-wrong-external-declaration) (alias vlib) (alias vlib-default-impl) + (alias vlib-wrong-default-impl) (alias windows-diff) (alias workspaces) (alias wrapped-false-main-module-name) @@ -1885,8 +1905,10 @@ (alias variants-external-declaration-conflict) (alias variants-multi-project) (alias variants-only-package) + (alias variants-wrong-external-declaration) (alias vlib) (alias vlib-default-impl) + (alias vlib-wrong-default-impl) (alias windows-diff) (alias workspaces) (alias wrapped-false-main-module-name) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/dune b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/dune new file mode 100644 index 000000000000..fb2c70786fde --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/dune @@ -0,0 +1,4 @@ +(executable + (name exe) + (libraries vlibfoo-ext) + (variants somevariant)) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/dune-project b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/dune-project new file mode 100644 index 000000000000..8a603347b8d2 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.10) +(using library_variants 0.1) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/exe.ml b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/exe.ml new file mode 100644 index 000000000000..abb3a1931c10 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/exe/exe.ml @@ -0,0 +1 @@ +let () = Vlibfoo.implme () \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/dune b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/dune new file mode 100644 index 000000000000..ec7d16112c19 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/dune @@ -0,0 +1,10 @@ +(library + (name vlibfoo) + (public_name vlibfoo-ext) + (virtual_modules vlibfoo) +) + +(external_variant + (virtual_library vlibfoo) + (variant somevariant) + (implementation not-an-implementation)) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/dune-project b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/dune-project new file mode 100644 index 000000000000..51cd215341f0 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.10) +(using library_variants 0.2) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/vlibfoo-ext.opam b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/vlibfoo-ext.opam new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/vlibfoo.mli b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/vlibfoo.mli new file mode 100644 index 000000000000..56a52c4170a4 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj1/vlibfoo.mli @@ -0,0 +1 @@ +val implme : unit -> unit diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/bar.ml b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/bar.ml new file mode 100644 index 000000000000..e7126a660141 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/bar.ml @@ -0,0 +1 @@ +let implme () = print_endline "foobar" diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/dune b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/dune new file mode 100644 index 000000000000..9f0dd16274ca --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/dune @@ -0,0 +1,4 @@ +(library + (name not_an_implementation) + (public_name not-an-implementation) +) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/dune-project b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/dune-project new file mode 100644 index 000000000000..8a603347b8d2 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.10) +(using library_variants 0.1) diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/not-an-implementation.opam b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/prj2/not-an-implementation.opam new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/blackbox-tests/test-cases/variants-wrong-external-declaration/run.t b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/run.t new file mode 100644 index 000000000000..df80c2e037f1 --- /dev/null +++ b/test/blackbox-tests/test-cases/variants-wrong-external-declaration/run.t @@ -0,0 +1,7 @@ +External declaration of an implementation, when the given library is not an +implementation, should fail. + + $ dune build exe/exe.exe + Error: "not-an-implementation" is not an implementation of "vlibfoo-ext". + -> required by executable exe in exe/dune:2 + [1] diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/dune-project b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/dune-project new file mode 100644 index 000000000000..8a603347b8d2 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.10) +(using library_variants 0.1) diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/exe/dune b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/exe/dune new file mode 100644 index 000000000000..7e316a71cef5 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/exe/dune @@ -0,0 +1,9 @@ +(executable + (name exe) + (libraries vlibfoo) +) + +(alias + (name default) + (action + (run ./exe.exe))) diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/exe/exe.ml b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/exe/exe.ml new file mode 100644 index 000000000000..abb3a1931c10 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/exe/exe.ml @@ -0,0 +1 @@ +let () = Vlibfoo.implme () \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/implfoo/bar.ml b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/implfoo/bar.ml new file mode 100644 index 000000000000..e11e2d7309a6 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/implfoo/bar.ml @@ -0,0 +1 @@ +let implme () = () \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/implfoo/dune b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/implfoo/dune new file mode 100644 index 000000000000..e37002685001 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/implfoo/dune @@ -0,0 +1,3 @@ +(library + (name not_an_implem) +) diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/run.t b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/run.t new file mode 100644 index 000000000000..d773b85741a3 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/run.t @@ -0,0 +1,7 @@ +Check that dune makes a proper error if the default implementation of a virtual +library is not actually an implementation of the virtual library. + + $ dune build @default + Error: "not_an_implem" is not an implementation of "vlibfoo". + -> required by executable exe in exe/dune:2 + [1] diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/vlibfoo/dune b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/vlibfoo/dune new file mode 100644 index 000000000000..17d24f531da6 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/vlibfoo/dune @@ -0,0 +1,5 @@ +(library + (name vlibfoo) + (virtual_modules vlibfoo) + (default_implementation not_an_implem) +) diff --git a/test/blackbox-tests/test-cases/vlib-wrong-default-impl/vlibfoo/vlibfoo.mli b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/vlibfoo/vlibfoo.mli new file mode 100644 index 000000000000..56a52c4170a4 --- /dev/null +++ b/test/blackbox-tests/test-cases/vlib-wrong-default-impl/vlibfoo/vlibfoo.mli @@ -0,0 +1 @@ +val implme : unit -> unit