Skip to content

Commit

Permalink
[compiler] [build-fs] Test for #1694
Browse files Browse the repository at this point in the history
  • Loading branch information
ejgallego committed Sep 28, 2024
1 parent 69bb025 commit 10847ff
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
17 changes: 17 additions & 0 deletions compiler/tests-full/dune
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@
(= %{ocaml_version} "5.2.0"))
(action
(diff stdlib.cma.expected.js stdlib.cma.output.js)))

(rule
(targets fs.output.js)
(deps file1 file2)
(action
(run
%{bin:js_of_ocaml}
build-fs
-o
%{targets}
file1:/static/file1
file2:/static/dir/file2)))

(rule
(alias runtest)
(action
(diff fs.expected.js fs.output.js)))
1 change: 1 addition & 0 deletions compiler/tests-full/file1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is file 1
1 change: 1 addition & 0 deletions compiler/tests-full/file2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is file 2
31 changes: 31 additions & 0 deletions compiler/tests-full/fs.expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function(a){
typeof globalThis !== "object"
&&
(this
? b()
: (a.defineProperty
(a.prototype, "_T_", {configurable: true, get: b}),
_T_));
function b(){
var b = this || self;
b.globalThis = b;
delete a.prototype._T_;
}
}
(Object));
(function(c){
"use strict";
function a(a, b){
if(c.jsoo_create_file)
c.jsoo_create_file(a, b);
else{
if(! c.caml_fs_tmp) c.caml_fs_tmp = [];
c.caml_fs_tmp.push({name: a, content: b});
}
return 0;
}
a("/static/file1", "This is file 1");
a("/static/dir/file2", "This is file 2");
return;
}
(globalThis));

0 comments on commit 10847ff

Please sign in to comment.