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 6817cc6
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
21 changes: 21 additions & 0 deletions compiler/tests-full/dune
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,24 @@
(= %{ocaml_version} "5.2.0"))
(action
(diff stdlib.cma.expected.js stdlib.cma.output.js)))

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

(rule
(alias runtest)
; (enabled_if
; (= %{ocaml_version} "5.2.0"))
(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\n");
a("/static/dir/file2", "This is file 2\n");
return;
}
(globalThis));

0 comments on commit 6817cc6

Please sign in to comment.