Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions test/blackbox-tests/test-cases/melange/flags.t
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Trying to build triggers both warnings
File "main.ml", line 1, characters 9-11:
1 | let t = "\e\n" in
^^
Error (warning 14 [illegal-backslash]): illegal backslash escape in string.
Warning 14 [illegal-backslash]: illegal backslash escape in string.
File "main.ml", line 1, characters 4-5:
1 | let t = "\e\n" in
^
Expand All @@ -62,6 +62,10 @@ Let's ignore them using compile_flags
> EOF

$ dune build @mel
File "main.ml", line 1, characters 9-11:
1 | let t = "\e\n" in
^^
Warning 14 [illegal-backslash]: illegal backslash escape in string.
$ node _build/default/output/main.js
hello

Expand All @@ -79,7 +83,7 @@ Can also pass flags from the env stanza. Let's go back to failing state:
File "main.ml", line 1, characters 9-11:
1 | let t = "\e\n" in
^^
Error (warning 14 [illegal-backslash]): illegal backslash escape in string.
Warning 14 [illegal-backslash]: illegal backslash escape in string.
File "main.ml", line 1, characters 4-5:
1 | let t = "\e\n" in
^
Expand All @@ -100,6 +104,10 @@ Adding env stanza with both warnings silenced allows the build to pass successfu
> EOF

$ dune build @mel
File "main.ml", line 1, characters 9-11:
1 | let t = "\e\n" in
^^
Warning 14 [illegal-backslash]: illegal backslash escape in string.
$ node _build/default/output/main.js
hello

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Test moving modules in a library with `(include_subdirs unqualified)`
Melange shows the proper path to `bar.js`

$ cat _build/default/output/lib/foo.js | grep bar.js
let Foo__Bar = require("./init/bar.js");
const Foo__Bar = require("./init/bar.js");

$ mv lib/init lib/end
$ dune build @mel

The import in `foo.js` has been updated to the new bar.js target

$ cat _build/default/output/lib/foo.js | grep bar.js
let Foo__Bar = require("./end/bar.js");
const Foo__Bar = require("./end/bar.js");

The initial file is not there anymore

Expand Down Expand Up @@ -79,15 +79,15 @@ Now try the same thing with `melange.emit`
Melange shows the proper path to `bar.js`

$ cat _build/default/output/foo.js | grep bar.js
let Melange__Bar = require("./init/bar.js");
const Melange__Bar = require("./init/bar.js");

$ mv init end
$ dune build @mel

The import in `foo.js` has been updated to the new bar.js target

$ cat _build/default/output/foo.js | grep bar.js
let Melange__Bar = require("./end/bar.js");
const Melange__Bar = require("./end/bar.js");

The initial file is not there anymore

Expand Down
12 changes: 12 additions & 0 deletions test/blackbox-tests/test-cases/melange/merlin.t
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@
Paths to Melange stdlib appear in B and S entries without melange.emit stanza

$ dune ocaml dump-dot-merlin $PWD | grep -e "^B " -e "^S "
B /MELC_STDLIB/__private__/melange_mini_stdlib/melange/.public_cmi_melange
B /MELC_STDLIB/melange
B /MELC_STDLIB/melange
B $TESTCASE_ROOT/_build/default/.foo.objs/melange
S /MELC_STDLIB
S /MELC_STDLIB/__private__/melange_mini_stdlib
S /MELC_STDLIB
S $TESTCASE_ROOT

Expand All @@ -68,10 +70,12 @@ Dump-dot-merlin includes the melange flags
$ dune ocaml dump-dot-merlin $PWD
EXCLUDE_QUERY_DIR
STDLIB /MELC_STDLIB/melange
B /MELC_STDLIB/__private__/melange_mini_stdlib/melange/.public_cmi_melange
B /MELC_STDLIB/melange
B /MELC_STDLIB/melange
B $TESTCASE_ROOT/_build/default/.output.mobjs/melange
S /MELC_STDLIB
S /MELC_STDLIB/__private__/melange_mini_stdlib
S /MELC_STDLIB
S $TESTCASE_ROOT
# FLG -w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -g -mel-g
Expand Down Expand Up @@ -113,6 +117,8 @@ User ppx flags should appear in merlin config
Bar: _build/default/bar
((STDLIB /MELC_STDLIB/melange)
(EXCLUDE_QUERY_DIR)
(B
/MELC_STDLIB/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B
$TESTCASE_ROOT/_build/default/.foo.objs/melange)
(S
Expand All @@ -135,6 +141,8 @@ User ppx flags should appear in merlin config
Bar: _build/default/bar.ml
((STDLIB /MELC_STDLIB/melange)
(EXCLUDE_QUERY_DIR)
(B
/MELC_STDLIB/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B
$TESTCASE_ROOT/_build/default/.foo.objs/melange)
(S
Expand All @@ -157,6 +165,8 @@ User ppx flags should appear in merlin config
Foo: _build/default/foo
((STDLIB /MELC_STDLIB/melange)
(EXCLUDE_QUERY_DIR)
(B
/MELC_STDLIB/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B
$TESTCASE_ROOT/_build/default/.foo.objs/melange)
(S
Expand All @@ -178,6 +188,8 @@ User ppx flags should appear in merlin config
Foo: _build/default/foo.ml-gen
((STDLIB /MELC_STDLIB/melange)
(EXCLUDE_QUERY_DIR)
(B
/MELC_STDLIB/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B
$TESTCASE_ROOT/_build/default/.foo.objs/melange)
(S
Expand Down
4 changes: 4 additions & 0 deletions test/blackbox-tests/test-cases/melange/ocaml-flags.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ The code in main contains unused var (warning 26) and illegal backlash (warning
Building does not fail, warnings are silenced

$ dune build @mel
File "main.ml", line 1, characters 9-11:
1 | let t = "\e\n" in
^^
Warning 14 [illegal-backslash]: illegal backslash escape in string.
$ node _build/default/output/main.js
hello

Expand Down
2 changes: 1 addition & 1 deletion test/blackbox-tests/test-cases/melange/private-lib-dep.t
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Melange public library depends on private library
// Generated by Melange
'use strict';

let Priv = require("foo.__private__.priv/priv.js");
const Priv = require("foo.__private__.priv/priv.js");

const x = "public lib uses " + Priv.x;

Expand Down
6 changes: 6 additions & 0 deletions test/blackbox-tests/test-cases/merlin/dialect.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ CRAM sanitization
X_mel: _build/default/melange/x_mel
((STDLIB lib/melange/melange)
(EXCLUDE_QUERY_DIR)
(B
lib/melange/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B lib/melange/js/melange)
(B lib/melange/melange)
(B
$TESTCASE_ROOT/_build/default/melange/.x_mel.objs/melange)
(S lib/melange)
(S lib/melange/__private__/melange_mini_stdlib)
(S lib/melange/js)
(S
$TESTCASE_ROOT/melange)
Expand All @@ -81,11 +84,14 @@ CRAM sanitization
X_mel: _build/default/melange/x_mel.mlx
((STDLIB lib/melange/melange)
(EXCLUDE_QUERY_DIR)
(B
lib/melange/__private__/melange_mini_stdlib/melange/.public_cmi_melange)
(B lib/melange/js/melange)
(B lib/melange/melange)
(B
$TESTCASE_ROOT/_build/default/melange/.x_mel.objs/melange)
(S lib/melange)
(S lib/melange/__private__/melange_mini_stdlib)
(S lib/melange/js)
(S
$TESTCASE_ROOT/melange)
Expand Down