Skip to content

Commit 6817cc6

Browse files
committed
[compiler] [build-fs] Test for #1694
1 parent 69bb025 commit 6817cc6

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

compiler/tests-full/dune

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,24 @@
2626
(= %{ocaml_version} "5.2.0"))
2727
(action
2828
(diff stdlib.cma.expected.js stdlib.cma.output.js)))
29+
30+
(rule
31+
(targets fs.output.js)
32+
; (enabled_if
33+
; (= %{ocaml_version} "5.2.0"))
34+
(deps file1 file2)
35+
(action
36+
(run
37+
%{bin:js_of_ocaml}
38+
build-fs
39+
-o
40+
%{targets}
41+
file1:/static/file1
42+
file2:/static/dir/file2)))
43+
44+
(rule
45+
(alias runtest)
46+
; (enabled_if
47+
; (= %{ocaml_version} "5.2.0"))
48+
(action
49+
(diff fs.expected.js fs.output.js)))

compiler/tests-full/file1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is file 1

compiler/tests-full/file2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is file 2

compiler/tests-full/fs.expected.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(function(a){
2+
typeof globalThis !== "object"
3+
&&
4+
(this
5+
? b()
6+
: (a.defineProperty
7+
(a.prototype, "_T_", {configurable: true, get: b}),
8+
_T_));
9+
function b(){
10+
var b = this || self;
11+
b.globalThis = b;
12+
delete a.prototype._T_;
13+
}
14+
}
15+
(Object));
16+
(function(c){
17+
"use strict";
18+
function a(a, b){
19+
if(c.jsoo_create_file)
20+
c.jsoo_create_file(a, b);
21+
else{
22+
if(! c.caml_fs_tmp) c.caml_fs_tmp = [];
23+
c.caml_fs_tmp.push({name: a, content: b});
24+
}
25+
return 0;
26+
}
27+
a("/static/file1", "This is file 1\n");
28+
a("/static/dir/file2", "This is file 2\n");
29+
return;
30+
}
31+
(globalThis));

0 commit comments

Comments
 (0)