diff --git a/compiler/tests-full/dune b/compiler/tests-full/dune index 802b8da1db..8c65e38b37 100644 --- a/compiler/tests-full/dune +++ b/compiler/tests-full/dune @@ -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))) diff --git a/compiler/tests-full/file1 b/compiler/tests-full/file1 new file mode 100644 index 0000000000..6a00e12055 --- /dev/null +++ b/compiler/tests-full/file1 @@ -0,0 +1 @@ +This is file 1 diff --git a/compiler/tests-full/file2 b/compiler/tests-full/file2 new file mode 100644 index 0000000000..4ab7e6dbb9 --- /dev/null +++ b/compiler/tests-full/file2 @@ -0,0 +1 @@ +This is file 2 diff --git a/compiler/tests-full/fs.expected.js b/compiler/tests-full/fs.expected.js new file mode 100644 index 0000000000..842753b626 --- /dev/null +++ b/compiler/tests-full/fs.expected.js @@ -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));