Skip to content

Commit

Permalink
test(melange): add a test that introduces rules in the target dir
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Nuno Monteiro <[email protected]>
  • Loading branch information
anmonteiro committed Feb 28, 2023
1 parent 3f75e20 commit 1ccb065
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Test that the target directory exists

$ cat > dune-project <<EOF
> (lang dune 3.7)
> (using melange 0.1)
> EOF

$ cat > dune <<EOF
> (melange.emit
> (alias melange)
> (target output)
> (module_system commonjs))
> EOF

Create the target dir

$ mkdir ./output
$ cat > output/dune <<EOF
> (rule
> (with-stdout-to index.txt (echo "hello")))
> (alias (name melange) (deps index.txt))
> EOF
$ cat > hello.ml <<EOF
> let () = Js.log "hello"
> EOF

$ dune build @melange
$ ls _build/default/output
hello.js
index.txt

Target promotion works

$ dune clean
$ cat > dune <<EOF
> (melange.emit
> (alias melange)
> (target output)
> (promote (until-clean))
> (module_system commonjs))
> EOF

$ dune build @melange
$ ls _build/default/output
hello.js
index.txt


0 comments on commit 1ccb065

Please sign in to comment.