Skip to content

Commit 4073f9e

Browse files
committed
add a test case to test both nodejs and es6 format
1 parent d04e07c commit 4073f9e

File tree

7 files changed

+43
-0
lines changed

7 files changed

+43
-0
lines changed

jscomp/test/build.ninja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ o test/epsilon_test.cmi test/epsilon_test.cmj : cc test/epsilon_test.ml | test/m
168168
o test/equal_box_test.cmi test/equal_box_test.cmj : cc test/equal_box_test.ml | test/mt.cmj $stdlib
169169
o test/equal_exception_test.cmi test/equal_exception_test.cmj : cc test/equal_exception_test.ml | test/mt.cmj $stdlib
170170
o test/equal_test.cmi test/equal_test.cmj : cc test/equal_test.ml | $stdlib
171+
o test/es6_export.cmi test/es6_export.cmj : cc test/es6_export.ml | $stdlib
172+
o test/es6_import.cmi test/es6_import.cmj : cc test/es6_import.ml | test/es6_export.cmj $stdlib
171173
o test/es6_module_test.cmi test/es6_module_test.cmj : cc test/es6_module_test.ml | test/mt.cmj $stdlib
172174
o test/escape_esmodule.cmi test/escape_esmodule.cmj : cc test/escape_esmodule.ml | $stdlib
173175
o test/esmodule_ref.cmi test/esmodule_ref.cmj : cc test/esmodule_ref.ml | test/escape_esmodule.cmj $stdlib

jscomp/test/es6_export.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
4+
var $$default = 3;
5+
6+
exports.$$default = $$default;
7+
exports.default = $$default;
8+
exports.__esModule = true;
9+
/* No side effect */

jscomp/test/es6_export.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
3+
4+
var $$default = 3;
5+
6+
export {
7+
$$default ,
8+
$$default as default,
9+
10+
}
11+
/* No side effect */

jscomp/test/es6_export.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[@@@config{flags = [|"-bs-package-output"; "es6:jscomp/test:.mjs"|]}]
2+
let default = 3

jscomp/test/es6_import.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
var Es6_export = require("./es6_export.js");
4+
5+
console.log(Es6_export.$$default);
6+
7+
/* Not a pure module */

jscomp/test/es6_import.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
3+
import * as Es6_export from "./es6_export.mjs";
4+
5+
console.log(Es6_export.$$default);
6+
7+
export {
8+
9+
}
10+
/* Not a pure module */

jscomp/test/es6_import.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[@@@config{flags = [|"-bs-package-output"; "es6:jscomp/test:.mjs"|]}]
2+
;; Js.log (Es6_export.default)

0 commit comments

Comments
 (0)