Skip to content

Commit

Permalink
test(melange): virtual library compilation with private libs (#11246)
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
  • Loading branch information
anmonteiro authored Dec 28, 2024
1 parent 4f15a12 commit 4757aa6
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/blackbox-tests/test-cases/melange/virtual-lib-private.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Test private virtual libraries and implementations

$ mkdir -p vlib js_impl test
$ cat > dune-project <<EOF
> (lang dune 3.13)
> (using melange 0.1)
> EOF
$ cat > vlib/dune <<EOF
> (library
> (name the_lib)
> (modes melange native)
> (virtual_modules virt))
> EOF
$ cat > vlib/the_lib.mli <<EOF
> module Time : sig
> val gettimeofday : unit -> float
> end
> EOF
$ cat > vlib/the_lib.ml <<EOF
> module Time = struct
> let gettimeofday () = Virt.gettimeofday ()
> end
> EOF
$ cat > vlib/virt.mli <<EOF
> val gettimeofday : unit -> float
> EOF

$ cat > js_impl/dune <<EOF
> (library
> (name timeJs)
> (implements the_lib)
> (modes melange)
> (preprocess (pps melange.ppx)))
> EOF
$ cat > js_impl/virt.ml <<EOF
> let gettimeofday : unit -> float = fun () -> 42.
> EOF

$ cat > test/dune <<EOF
> (melange.emit
> (target output)
> (libraries the_lib timeJs)
> (emit_stdlib false))
> EOF

$ dune build @melange

0 comments on commit 4757aa6

Please sign in to comment.