Skip to content

Commit 41c029f

Browse files
committed
Add a test case
1 parent 60d802f commit 41c029f

10 files changed

+45
-3
lines changed

jscomp/test/bigarray_test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var Bigarray = require("../../lib/js/bigarray.js");
34
var Caml_int32 = require("../../lib/js/caml_int32.js");
45
var Caml_external_polyfill = require("../../lib/js/caml_external_polyfill.js");
56

@@ -42,4 +43,4 @@ exports.sum = sum;
4243
exports.init = init;
4344
exports.init2 = init2;
4445
exports.init3 = init3;
45-
/* No side effect */
46+
/* Bigarray Not a pure module */

jscomp/test/build.ninja

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
bsc = ../lib/bsc.exe
3-
bsc_flags = -absname -no-alias-deps -bs-no-version-header -bs-diagnose -bs-cross-module-opt -bs-package-name bs-platform -bs-package-output commonjs:jscomp/test -w -40-52 -warn-error A+8-3-30-26+101-102-103-104-52 -bin-annot -I runtime -I $stdlib -I others
3+
bsc_flags = -absname -bs-no-version-header -bs-diagnose -bs-cross-module-opt -bs-package-name bs-platform -bs-package-output commonjs:jscomp/test -w -40-52 -warn-error A+8-3-30-26+101-102-103-104-52 -bin-annot -I runtime -I $stdlib -I others
44

55
rule cc
66
command = $bsc -bs-cmi -bs-cmj $bsc_flags -I test $in
@@ -297,6 +297,10 @@ build test/gpr_3609_test.cmi test/gpr_3609_test.cmj : cc test/gpr_3609_test.ml |
297297
build test/gpr_3697_test.cmi test/gpr_3697_test.cmj : cc test/gpr_3697_test.ml | $stdlib
298298
build test/gpr_373_test.cmi test/gpr_373_test.cmj : cc test/gpr_373_test.ml | $stdlib
299299
build test/gpr_3770_test.cmi test/gpr_3770_test.cmj : cc test/gpr_3770_test.ml | $stdlib
300+
build test/gpr_3852_alias.cmi test/gpr_3852_alias.cmj : cc test/gpr_3852_alias.ml | test/gpr_3852_effect.cmj $stdlib
301+
build test/gpr_3852_alias_reify.cmj : cc_cmi test/gpr_3852_alias_reify.ml | test/gpr_3852_alias_reify.cmi test/gpr_3852_effect.cmj $stdlib
302+
build test/gpr_3852_alias_reify.cmi : cc test/gpr_3852_alias_reify.mli | $stdlib
303+
build test/gpr_3852_effect.cmi test/gpr_3852_effect.cmj : cc test/gpr_3852_effect.ml | $stdlib
300304
build test/gpr_3865.cmi test/gpr_3865.cmj : cc test/gpr_3865.re | test/gpr_3865_bar.cmj test/gpr_3865_foo.cmj $stdlib
301305
build test/gpr_3865_bar.cmi test/gpr_3865_bar.cmj : cc test/gpr_3865_bar.re | $stdlib
302306
build test/gpr_3865_foo.cmi test/gpr_3865_foo.cmj : cc test/gpr_3865_foo.re | $stdlib

jscomp/test/gpr_3852_alias.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
var Gpr_3852_effect = require("./gpr_3852_effect.js");
4+
5+
var A = 0;
6+
7+
exports.A = A;
8+
/* Gpr_3852_effect Not a pure module */

jscomp/test/gpr_3852_alias.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
module A = Gpr_3852_effect
4+
5+
(* It should generate a dummy JS file *)

jscomp/test/gpr_3852_alias_reify.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
var Gpr_3852_effect = require("./gpr_3852_effect.js");
4+
5+
var A = Gpr_3852_effect;
6+
7+
exports.A = A;
8+
/* Gpr_3852_effect Not a pure module */

jscomp/test/gpr_3852_alias_reify.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module A = Gpr_3852_effect

jscomp/test/gpr_3852_alias_reify.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module A : sig
2+
val v : int
3+
end

jscomp/test/gpr_3852_effect.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+
console.log("hello");
5+
6+
var v = 0;
7+
8+
exports.v = v;
9+
/* Not a pure module */

jscomp/test/gpr_3852_effect.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
let v = 0
3+
let () = Js.log "hello"

scripts/ninja.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ async function testNinja() {
12291229
var ninjaCwd = `test`;
12301230
var templateTestRules = `
12311231
${BSC_COMPILER}
1232-
bsc_flags = -absname -no-alias-deps -bs-no-version-header -bs-diagnose -bs-cross-module-opt -bs-package-name bs-platform -bs-package-output commonjs:jscomp/test -w -40-52 -warn-error A+8-3-30-26+101-102-103-104-52 -bin-annot -I runtime -I $stdlib -I others
1232+
bsc_flags = -absname -bs-no-version-header -bs-diagnose -bs-cross-module-opt -bs-package-name bs-platform -bs-package-output commonjs:jscomp/test -w -40-52 -warn-error A+8-3-30-26+101-102-103-104-52 -bin-annot -I runtime -I $stdlib -I others
12331233
${ruleCC(ninjaCwd)}
12341234
12351235

0 commit comments

Comments
 (0)