forked from ocaml/dune
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
melange: add installation test for two modes (#5)
Signed-off-by: Javier Chávarri <[email protected]>
- Loading branch information
1 parent
a936818
commit 505d383
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
test/blackbox-tests/test-cases/melange/emit-installed-two-modes.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,94 @@ | ||
Test dependency on installed package | ||
|
||
$ mkdir a b c prefix | ||
|
||
$ cat > a/dune-project <<EOF | ||
> (lang dune 3.6) | ||
> (package (name a)) | ||
> (using melange 0.1) | ||
> EOF | ||
$ cat > a/dune <<EOF | ||
> (library | ||
> (modes byte melange) | ||
> (public_name a)) | ||
> EOF | ||
|
||
$ cat > a/foo.ml <<EOF | ||
> let x = "foo" | ||
> EOF | ||
|
||
$ dune build --root a | ||
Entering directory 'a' | ||
Leaving directory 'a' | ||
|
||
$ dune install --root a --prefix $PWD/prefix | ||
Installing $TESTCASE_ROOT/prefix/lib/a/META | ||
Installing $TESTCASE_ROOT/prefix/lib/a/a.cma | ||
Installing $TESTCASE_ROOT/prefix/lib/a/a.cmi | ||
Installing $TESTCASE_ROOT/prefix/lib/a/a.cmt | ||
Installing $TESTCASE_ROOT/prefix/lib/a/a.ml | ||
Installing $TESTCASE_ROOT/prefix/lib/a/a__Foo.cmi | ||
Installing $TESTCASE_ROOT/prefix/lib/a/a__Foo.cmt | ||
Installing $TESTCASE_ROOT/prefix/lib/a/dune-package | ||
Installing $TESTCASE_ROOT/prefix/lib/a/foo.ml | ||
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a.cmi | ||
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a.cmj | ||
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a.cmt | ||
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a__Foo.cmi | ||
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a__Foo.cmj | ||
Installing $TESTCASE_ROOT/prefix/lib/a/melange/a__Foo.cmt | ||
|
||
$ cat >b/dune-project <<EOF | ||
> (lang dune 3.6) | ||
> (using melange 0.1) | ||
> EOF | ||
|
||
$ cat > b/dune <<EOF | ||
> (melange.emit | ||
> (target dist) | ||
> (alias dist) | ||
> (libraries a) | ||
> (module_system commonjs)) | ||
> EOF | ||
|
||
$ cat > b/bar.ml <<EOF | ||
> let x = Js.log A.Foo.x | ||
> EOF | ||
|
||
$ OCAMLPATH=$PWD/prefix/lib/:$OCAMLPATH dune build --root b @dist --display=short | ||
Entering directory 'b' | ||
melc dist/node_modules/a/a.js | ||
melc dist/node_modules/a/foo.js | ||
melc .dist.mobjs/melange/melange__Bar.{cmi,cmj,cmt} | ||
melc dist/bar.js | ||
Leaving directory 'b' | ||
|
||
$ node b/_build/default/dist/bar.js | ||
foo | ||
|
||
$ cat >c/dune-project <<EOF | ||
> (lang dune 3.6) | ||
> (using melange 0.1) | ||
> EOF | ||
|
||
$ cat > c/dune <<EOF | ||
> (melange.emit | ||
> (target dist) | ||
> (alias dist) | ||
> (libraries a) | ||
> (module_system commonjs)) | ||
> EOF | ||
|
||
$ cat > c/dune <<EOF | ||
> (executable | ||
> (name bar) | ||
> (modes byte) | ||
> (libraries a)) | ||
> EOF | ||
|
||
$ cat > c/bar.ml <<EOF | ||
> let () = print_endline A.Foo.x | ||
> EOF | ||
|
||
$ OCAMLPATH=$PWD/prefix/lib/:$OCAMLPATH dune exec ./c/bar.exe | ||
foo |