-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* playground: add test to show broken state with alerts * show alerts in playground * update bin/jsoo_main.ml Co-authored-by: Antonio Nuno Monteiro <[email protected]> * fix build * fix alerts handling --------- Co-authored-by: Antonio Nuno Monteiro <[email protected]>
- Loading branch information
1 parent
ab16b82
commit a0bdacb
Showing
2 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
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
51 changes: 51 additions & 0 deletions
51
test/blackbox-tests/melange-playground/compile-ml-warning-alert.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,51 @@ | ||
$ cat > input.js <<EOF | ||
> require(process.env.DUNE_SOURCEROOT + '/_build/default/bin/jsoo_main.bc.js'); | ||
> require(process.env.DUNE_SOURCEROOT + '/_build/default/bin/melange-cmijs.js'); | ||
> console.log(ocaml.compileML("let t = Js.Vector.length")); | ||
> EOF | ||
|
||
$ node input.js | ||
{ | ||
js_code: '// Generated by Melange\n' + | ||
'\n' + | ||
'\n' + | ||
'function t(prim) {\n' + | ||
' return prim.length;\n' + | ||
'}\n' + | ||
'\n' + | ||
'export {\n' + | ||
' t ,\n' + | ||
'}\n' + | ||
'/* No side effect */\n', | ||
warnings: [ | ||
{ | ||
js_warning_error_msg: 'Line 1, 8:\n Alert: deprecated module Js.Vector\nUse Belt.Array instead', | ||
row: 0, | ||
column: 8, | ||
endRow: 0, | ||
endColumn: 24, | ||
text: 'module Js.Vector\nUse Belt.Array instead', | ||
type: 'alert' | ||
} | ||
], | ||
type_hints: [ | ||
{ | ||
start: [Object], | ||
end: [Object], | ||
kind: 'expression', | ||
hint: "'a Js.Vector.t -> int" | ||
}, | ||
{ | ||
start: [Object], | ||
end: [Object], | ||
kind: 'pattern_type', | ||
hint: "'a Js.Vector.t -> int" | ||
}, | ||
{ | ||
start: [Object], | ||
end: [Object], | ||
kind: 'binding', | ||
hint: "'a Js.Vector.t -> int" | ||
} | ||
] | ||
} |