From a23a7faf5acec407eed314f2448962fb59b995f1 Mon Sep 17 00:00:00 2001 From: Antonio Nuno Monteiro Date: Fri, 4 Aug 2023 16:01:20 -0700 Subject: [PATCH] chore: delete promoted removed tests (#676) --- jscomp/test/dist/jscomp/test/genlex_test.js | 122 ------ .../test/dist/jscomp/test/re_or_res/gh_161.js | 13 - .../jscomp/test/re_or_res/gpr_4931_allow.js | 12 - .../dist/jscomp/test/re_or_res/gpr_5312.js | 8 - .../dist/jscomp/test/re_or_res/hello_res.js | 22 - .../jscomp/test/re_or_res/inline_map_demo.js | 195 --------- .../jscomp/test/re_or_res/rescript_compat.js | 10 - .../jscomp/test/re_or_res/then_mangle_test.js | 27 -- .../test/re_or_res/unboxed_attribute.js | 13 - .../dist/jscomp/test/stream_parser_test.js | 334 --------------- .../test/dist/jscomp/test/utf8_decode_test.js | 393 ------------------ 11 files changed, 1149 deletions(-) delete mode 100644 jscomp/test/dist/jscomp/test/genlex_test.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/gh_161.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/gpr_4931_allow.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/gpr_5312.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/hello_res.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/inline_map_demo.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/rescript_compat.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/then_mangle_test.js delete mode 100644 jscomp/test/dist/jscomp/test/re_or_res/unboxed_attribute.js delete mode 100644 jscomp/test/dist/jscomp/test/stream_parser_test.js delete mode 100644 jscomp/test/dist/jscomp/test/utf8_decode_test.js diff --git a/jscomp/test/dist/jscomp/test/genlex_test.js b/jscomp/test/dist/jscomp/test/genlex_test.js deleted file mode 100644 index 7c0894a896..0000000000 --- a/jscomp/test/dist/jscomp/test/genlex_test.js +++ /dev/null @@ -1,122 +0,0 @@ -// Generated by Melange -'use strict'; - -var Caml_js_exceptions = require("melange.js/caml_js_exceptions.js"); -var Mt = require("./mt.js"); -var Stdlib__Genlex = require("melange/genlex.js"); -var Stdlib__List = require("melange/list.js"); -var Stdlib__Stream = require("melange/stream.js"); - -var lexer = Stdlib__Genlex.make_lexer({ - hd: "+", - tl: { - hd: "-", - tl: { - hd: "*", - tl: { - hd: "/", - tl: { - hd: "let", - tl: { - hd: "=", - tl: { - hd: "(", - tl: { - hd: ")", - tl: /* [] */0 - } - } - } - } - } - } - } - }); - -function to_list(s) { - var _acc = /* [] */0; - while(true) { - var acc = _acc; - var v; - try { - v = Stdlib__Stream.next(s); - } - catch (raw_exn){ - var exn = Caml_js_exceptions.internalToOCamlException(raw_exn); - if (exn.RE_EXN_ID === Stdlib__Stream.Failure) { - return Stdlib__List.rev(acc); - } - throw exn; - } - _acc = { - hd: v, - tl: acc - }; - continue ; - }; -} - -var suites_0 = [ - "lexer_stream_genlex", - (function (param) { - return { - TAG: /* Eq */0, - _0: { - hd: { - TAG: /* Int */2, - _0: 3 - }, - tl: { - hd: { - TAG: /* Kwd */0, - _0: "(" - }, - tl: { - hd: { - TAG: /* Int */2, - _0: 3 - }, - tl: { - hd: { - TAG: /* Kwd */0, - _0: "+" - }, - tl: { - hd: { - TAG: /* Int */2, - _0: 2 - }, - tl: { - hd: { - TAG: /* Int */2, - _0: -1 - }, - tl: { - hd: { - TAG: /* Kwd */0, - _0: ")" - }, - tl: /* [] */0 - } - } - } - } - } - } - }, - _1: to_list(lexer(Stdlib__Stream.of_string("3(3 + 2 -1)"))) - }; - }) -]; - -var suites = { - hd: suites_0, - tl: /* [] */0 -}; - -Mt.from_pair_suites("Genlex_test", suites); - -exports.lexer = lexer; -exports.to_list = to_list; -exports.suites = suites; -/* lexer Not a pure module */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/gh_161.js b/jscomp/test/dist/jscomp/test/re_or_res/gh_161.js deleted file mode 100644 index ff77ff7acf..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/gh_161.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by Melange -'use strict'; - - -var X = {}; - -function builds_in_melange(param) { - return 0; -} - -exports.X = X; -exports.builds_in_melange = builds_in_melange; -/* No side effect */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/gpr_4931_allow.js b/jscomp/test/dist/jscomp/test/re_or_res/gpr_4931_allow.js deleted file mode 100644 index 2801376a6d..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/gpr_4931_allow.js +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by Melange -'use strict'; - - -if(import.meta.hot) { - import.meta.hot.accept(); -}else{ - console.log("ok") -} -; - -/* Not a pure module */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/gpr_5312.js b/jscomp/test/dist/jscomp/test/re_or_res/gpr_5312.js deleted file mode 100644 index 02d7017c46..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/gpr_5312.js +++ /dev/null @@ -1,8 +0,0 @@ -// Generated by Melange -'use strict'; - - -var MyModule = {}; - -exports.MyModule = MyModule; -/* No side effect */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/hello_res.js b/jscomp/test/dist/jscomp/test/re_or_res/hello_res.js deleted file mode 100644 index 174d67028a..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/hello_res.js +++ /dev/null @@ -1,22 +0,0 @@ -// Generated by Melange -'use strict'; - -var Stdlib__List = require("melange/list.js"); - -var b = Stdlib__List.length({ - hd: 1, - tl: { - hd: 2, - tl: { - hd: 3, - tl: /* [] */0 - } - } - }); - -var a = b - 1 | 0; - -console.log("hello, res"); - -exports.a = a; -/* b Not a pure module */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/inline_map_demo.js b/jscomp/test/dist/jscomp/test/re_or_res/inline_map_demo.js deleted file mode 100644 index a6aa252c10..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/inline_map_demo.js +++ /dev/null @@ -1,195 +0,0 @@ -// Generated by Melange -'use strict'; - -var Caml = require("melange.js/caml.js"); -var Mt = require("../mt.js"); -var Stdlib = require("melange/stdlib.js"); -var Stdlib__List = require("melange/list.js"); - -function height(x) { - if (x) { - return x._4; - } else { - return 0; - } -} - -function create(l, x, d, r) { - var hl = height(l); - var hr = height(r); - return /* Node */{ - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; -} - -function bal(l, x, d, r) { - var hl = l ? l._4 : 0; - var hr = r ? r._4 : 0; - if (hl > (hr + 2 | 0)) { - if (l) { - var lr = l._3; - var ld = l._2; - var lv = l._1; - var ll = l._0; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } - if (lr) { - return create(create(ll, lv, ld, lr._0), lr._1, lr._2, create(lr._3, x, d, r)); - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "jscomp/test/re_or_res/inline_map_demo.res", - 48, - 19 - ], - Error: new Error() - }; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "jscomp/test/re_or_res/inline_map_demo.res", - 42, - 15 - ], - Error: new Error() - }; - } - if (hr <= (hl + 2 | 0)) { - return /* Node */{ - _0: l, - _1: x, - _2: d, - _3: r, - _4: hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - }; - } - if (r) { - var rr = r._3; - var rd = r._2; - var rv = r._1; - var rl = r._0; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } - if (rl) { - return create(create(l, x, d, rl._0), rl._1, rl._2, create(rl._3, rv, rd, rr)); - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "jscomp/test/re_or_res/inline_map_demo.res", - 62, - 19 - ], - Error: new Error() - }; - } - throw { - RE_EXN_ID: "Assert_failure", - _1: [ - "jscomp/test/re_or_res/inline_map_demo.res", - 56, - 15 - ], - Error: new Error() - }; -} - -function add(x, data, tree) { - if (!tree) { - return /* Node */{ - _0: /* Empty */0, - _1: x, - _2: data, - _3: /* Empty */0, - _4: 1 - }; - } - var r = tree._3; - var d = tree._2; - var v = tree._1; - var l = tree._0; - var c = Caml.caml_int_compare(x, v); - if (c === 0) { - return /* Node */{ - _0: l, - _1: x, - _2: data, - _3: r, - _4: tree._4 - }; - } else if (c < 0) { - return bal(add(x, data, l), v, d, r); - } else { - return bal(l, v, d, add(x, data, r)); - } -} - -var m = Stdlib__List.fold_left((function (acc, param) { - return add(param[0], param[1], acc); - }), /* Empty */0, { - hd: [ - 10, - /* 'a' */97 - ], - tl: { - hd: [ - 3, - /* 'b' */98 - ], - tl: { - hd: [ - 7, - /* 'c' */99 - ], - tl: { - hd: [ - 20, - /* 'd' */100 - ], - tl: /* [] */0 - } - } - } - }); - -function find(px, _x) { - while(true) { - var x = _x; - if (x) { - var c = Caml.caml_int_compare(px, x._1); - if (c === 0) { - return x._2; - } - _x = c < 0 ? x._0 : x._3; - continue ; - } - throw { - RE_EXN_ID: Stdlib.Not_found, - Error: new Error() - }; - }; -} - -Mt.from_pair_suites("Inline_map_demo", { - hd: [ - "find", - (function (param) { - return { - TAG: /* Eq */0, - _0: find(10, m), - _1: /* 'a' */97 - }; - }) - ], - tl: /* [] */0 - }); - -/* m Not a pure module */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/rescript_compat.js b/jscomp/test/dist/jscomp/test/re_or_res/rescript_compat.js deleted file mode 100644 index 8b20b1e0c2..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/rescript_compat.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by Melange -'use strict'; - - -function set_onreadystatechange(cb, x) { - x.some_prop = cb; -} - -exports.set_onreadystatechange = set_onreadystatechange; -/* No side effect */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/then_mangle_test.js b/jscomp/test/dist/jscomp/test/re_or_res/then_mangle_test.js deleted file mode 100644 index 2b51284597..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/then_mangle_test.js +++ /dev/null @@ -1,27 +0,0 @@ -// Generated by Melange -'use strict'; - -var Mt = require("../mt.js"); - -var suites = { - contents: /* [] */0 -}; - -var test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - Mt.eq_suites(test_id, suites, loc, x, y); -} - -function then(a, b) { - console.log("no inline"); - return Math.imul(a, a) + Math.imul(b, b) | 0; -} - -eq("File \"jscomp/test/re_or_res/then_mangle_test.res\", line 14, characters 3-10", then(1, 2), 5); - -Mt.from_pair_suites("jscomp/test/re_or_res/then_mangle_test.res", suites.contents); - -/* Not a pure module */ diff --git a/jscomp/test/dist/jscomp/test/re_or_res/unboxed_attribute.js b/jscomp/test/dist/jscomp/test/re_or_res/unboxed_attribute.js deleted file mode 100644 index 709f73168a..0000000000 --- a/jscomp/test/dist/jscomp/test/re_or_res/unboxed_attribute.js +++ /dev/null @@ -1,13 +0,0 @@ -// Generated by Melange -'use strict'; - - -function u(param) { - return [ - 3, - u - ]; -} - -exports.u = u; -/* No side effect */ diff --git a/jscomp/test/dist/jscomp/test/stream_parser_test.js b/jscomp/test/dist/jscomp/test/stream_parser_test.js deleted file mode 100644 index 3224a38c2e..0000000000 --- a/jscomp/test/dist/jscomp/test/stream_parser_test.js +++ /dev/null @@ -1,334 +0,0 @@ -// Generated by Melange -'use strict'; - -var Caml_exceptions = require("melange.js/caml_exceptions.js"); -var Caml_int32 = require("melange.js/caml_int32.js"); -var Curry = require("melange.js/curry.js"); -var Mt = require("./mt.js"); -var Stdlib__Genlex = require("melange/genlex.js"); -var Stdlib__Queue = require("melange/queue.js"); -var Stdlib__Stream = require("melange/stream.js"); - -var Parse_error = /* @__PURE__ */Caml_exceptions.create("Stream_parser_test.Parse_error"); - -function parse(token) { - var look_ahead = { - length: 0, - first: /* Nil */0, - last: /* Nil */0 - }; - var token$1 = function (param) { - if (look_ahead.length !== 0) { - return Stdlib__Queue.pop(look_ahead); - } - try { - return Curry._1(token, undefined); - } - catch (exn){ - return { - TAG: /* Kwd */0, - _0: "==" - }; - } - }; - var parse_atom = function (param) { - var n = token$1(undefined); - switch (n.TAG | 0) { - case /* Kwd */0 : - if (n._0 === "(") { - var v = parse_expr_aux(parse_term_aux(parse_atom(undefined))); - var match = token$1(undefined); - if (match.TAG === /* Kwd */0) { - if (match._0 === ")") { - return v; - } - throw { - RE_EXN_ID: Parse_error, - _1: "Unbalanced parens", - Error: new Error() - }; - } - throw { - RE_EXN_ID: Parse_error, - _1: "Unbalanced parens", - Error: new Error() - }; - } - Stdlib__Queue.push(n, look_ahead); - throw { - RE_EXN_ID: Parse_error, - _1: "unexpected token", - Error: new Error() - }; - case /* Int */2 : - return n._0; - default: - Stdlib__Queue.push(n, look_ahead); - throw { - RE_EXN_ID: Parse_error, - _1: "unexpected token", - Error: new Error() - }; - } - }; - var parse_term_aux = function (e1) { - var e = token$1(undefined); - if (e.TAG === /* Kwd */0) { - switch (e._0) { - case "*" : - return Math.imul(e1, parse_term_aux(parse_atom(undefined))); - case "/" : - return Caml_int32.div(e1, parse_term_aux(parse_atom(undefined))); - default: - Stdlib__Queue.push(e, look_ahead); - return e1; - } - } else { - Stdlib__Queue.push(e, look_ahead); - return e1; - } - }; - var parse_expr_aux = function (e1) { - var e = token$1(undefined); - if (e.TAG === /* Kwd */0) { - switch (e._0) { - case "+" : - return e1 + parse_expr_aux(parse_term_aux(parse_atom(undefined))) | 0; - case "-" : - return e1 - parse_expr_aux(parse_term_aux(parse_atom(undefined))) | 0; - default: - Stdlib__Queue.push(e, look_ahead); - return e1; - } - } else { - Stdlib__Queue.push(e, look_ahead); - return e1; - } - }; - var r = parse_expr_aux(parse_term_aux(parse_atom(undefined))); - return [ - r, - Stdlib__Queue.fold((function (acc, x) { - return { - hd: x, - tl: acc - }; - }), /* [] */0, look_ahead) - ]; -} - -var lexer = Stdlib__Genlex.make_lexer({ - hd: "(", - tl: { - hd: "*", - tl: { - hd: "/", - tl: { - hd: "+", - tl: { - hd: "-", - tl: { - hd: ")", - tl: /* [] */0 - } - } - } - } - } - }); - -function token(chars) { - var strm = lexer(chars); - return function (param) { - return Stdlib__Stream.next(strm); - }; -} - -function l_parse(token) { - var look_ahead = { - length: 0, - first: /* Nil */0, - last: /* Nil */0 - }; - var token$1 = function (param) { - if (look_ahead.length !== 0) { - return Stdlib__Queue.pop(look_ahead); - } - try { - return Curry._1(token, undefined); - } - catch (exn){ - return { - TAG: /* Kwd */0, - _0: "==" - }; - } - }; - var parse_f = function (param) { - var i = token$1(undefined); - switch (i.TAG | 0) { - case /* Kwd */0 : - if (i._0 === "(") { - var v = parse_t_aux(parse_f_aux(parse_f(undefined))); - var t = token$1(undefined); - if (t.TAG === /* Kwd */0) { - if (t._0 === ")") { - return v; - } - throw { - RE_EXN_ID: Parse_error, - _1: "Unbalanced )", - Error: new Error() - }; - } - throw { - RE_EXN_ID: Parse_error, - _1: "Unbalanced )", - Error: new Error() - }; - } - throw { - RE_EXN_ID: Parse_error, - _1: "Unexpected token", - Error: new Error() - }; - case /* Int */2 : - return i._0; - default: - throw { - RE_EXN_ID: Parse_error, - _1: "Unexpected token", - Error: new Error() - }; - } - }; - var parse_t_aux = function (_a) { - while(true) { - var a = _a; - var t = token$1(undefined); - if (t.TAG === /* Kwd */0) { - switch (t._0) { - case "+" : - _a = a + parse_f_aux(parse_f(undefined)) | 0; - continue ; - case "-" : - _a = a - parse_f_aux(parse_f(undefined)) | 0; - continue ; - default: - Stdlib__Queue.push(t, look_ahead); - return a; - } - } else { - Stdlib__Queue.push(t, look_ahead); - return a; - } - }; - }; - var parse_f_aux = function (_a) { - while(true) { - var a = _a; - var t = token$1(undefined); - if (t.TAG === /* Kwd */0) { - switch (t._0) { - case "*" : - _a = Math.imul(a, parse_f(undefined)); - continue ; - case "/" : - _a = Caml_int32.div(a, parse_f(undefined)); - continue ; - default: - Stdlib__Queue.push(t, look_ahead); - return a; - } - } else { - Stdlib__Queue.push(t, look_ahead); - return a; - } - }; - }; - var r = parse_t_aux(parse_f_aux(parse_f(undefined))); - return [ - r, - Stdlib__Queue.fold((function (acc, x) { - return { - hd: x, - tl: acc - }; - }), /* [] */0, look_ahead) - ]; -} - -var suites = { - contents: /* [] */0 -}; - -var test_id = { - contents: 0 -}; - -function eq(loc, x, y) { - test_id.contents = test_id.contents + 1 | 0; - suites.contents = { - hd: [ - loc + (" id " + String(test_id.contents)), - (function (param) { - return { - TAG: /* Eq */0, - _0: x, - _1: y - }; - }) - ], - tl: suites.contents - }; -} - -var match = parse(token(Stdlib__Stream.of_string("1 + 2 + (3 - 2) * 3 * 3 - 2 a"))); - -eq("File \"stream_parser_test.ml\", line 132, characters 5-12", [ - match[0], - match[1] - ], [ - 10, - { - hd: { - TAG: /* Ident */1, - _0: "a" - }, - tl: /* [] */0 - } - ]); - -eq("File \"stream_parser_test.ml\", line 133, characters 5-12", [ - 2, - { - hd: { - TAG: /* Kwd */0, - _0: "==" - }, - tl: /* [] */0 - } - ], parse(token(Stdlib__Stream.of_string("3 - 2 - 1")))); - -eq("File \"stream_parser_test.ml\", line 134, characters 5-12", [ - 0, - { - hd: { - TAG: /* Kwd */0, - _0: "==" - }, - tl: /* [] */0 - } - ], l_parse(token(Stdlib__Stream.of_string("3 - 2 - 1")))); - -Mt.from_pair_suites("Stream_parser_test", suites.contents); - -exports.Parse_error = Parse_error; -exports.parse = parse; -exports.lexer = lexer; -exports.token = token; -exports.l_parse = l_parse; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* lexer Not a pure module */ diff --git a/jscomp/test/dist/jscomp/test/utf8_decode_test.js b/jscomp/test/dist/jscomp/test/utf8_decode_test.js deleted file mode 100644 index 4490f78f4a..0000000000 --- a/jscomp/test/dist/jscomp/test/utf8_decode_test.js +++ /dev/null @@ -1,393 +0,0 @@ -// Generated by Melange -'use strict'; - -var Caml_bytes = require("melange.js/caml_bytes.js"); -var Curry = require("melange.js/curry.js"); -var Mt = require("./mt.js"); -var Stdlib__List = require("melange/list.js"); -var Stdlib__Stream = require("melange/stream.js"); - -function classify(chr) { - if ((chr & 128) === 0) { - return { - TAG: /* Single */0, - _0: chr - }; - } else if ((chr & 64) === 0) { - return { - TAG: /* Cont */1, - _0: chr & 63 - }; - } else if ((chr & 32) === 0) { - return { - TAG: /* Leading */2, - _0: 1, - _1: chr & 31 - }; - } else if ((chr & 16) === 0) { - return { - TAG: /* Leading */2, - _0: 2, - _1: chr & 15 - }; - } else if ((chr & 8) === 0) { - return { - TAG: /* Leading */2, - _0: 3, - _1: chr & 7 - }; - } else if ((chr & 4) === 0) { - return { - TAG: /* Leading */2, - _0: 4, - _1: chr & 3 - }; - } else if ((chr & 2) === 0) { - return { - TAG: /* Leading */2, - _0: 5, - _1: chr & 1 - }; - } else { - return /* Invalid */0; - } -} - -function utf8_decode(strm) { - return Stdlib__Stream.slazy(function (param) { - var chr = Stdlib__Stream.peek(strm); - if (chr === undefined) { - return ; - } - Stdlib__Stream.junk(strm); - var c = classify(chr); - if (typeof c === "number") { - throw { - RE_EXN_ID: Stdlib__Stream.$$Error, - _1: "Invalid byte", - Error: new Error() - }; - } - switch (c.TAG | 0) { - case /* Single */0 : - return Stdlib__Stream.icons(c._0, utf8_decode(strm)); - case /* Cont */1 : - throw { - RE_EXN_ID: Stdlib__Stream.$$Error, - _1: "Unexpected continuation byte", - Error: new Error() - }; - case /* Leading */2 : - var follow = function (strm, _n, _c) { - while(true) { - var c = _c; - var n = _n; - if (n === 0) { - return c; - } - var cc = classify(Stdlib__Stream.next(strm)); - if (typeof cc === "number") { - throw { - RE_EXN_ID: Stdlib__Stream.$$Error, - _1: "Continuation byte expected", - Error: new Error() - }; - } - if (cc.TAG === /* Cont */1) { - _c = (c << 6) | cc._0 & 63; - _n = n - 1 | 0; - continue ; - } - throw { - RE_EXN_ID: Stdlib__Stream.$$Error, - _1: "Continuation byte expected", - Error: new Error() - }; - }; - }; - return Stdlib__Stream.icons(follow(strm, c._0, c._1), utf8_decode(strm)); - - } - }); -} - -function to_list(xs) { - var v = { - contents: /* [] */0 - }; - Stdlib__Stream.iter((function (x) { - v.contents = { - hd: x, - tl: v.contents - }; - }), xs); - return Stdlib__List.rev(v.contents); -} - -function utf8_list(s) { - return to_list(utf8_decode(Stdlib__Stream.of_string(s))); -} - -function decode(bytes, offset) { - var c = classify(Caml_bytes.get(bytes, offset)); - if (typeof c === "number") { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "decode", - Error: new Error() - }; - } - switch (c.TAG | 0) { - case /* Single */0 : - return [ - c._0, - offset + 1 | 0 - ]; - case /* Cont */1 : - throw { - RE_EXN_ID: "Invalid_argument", - _1: "decode", - Error: new Error() - }; - case /* Leading */2 : - var _n = c._0; - var _c = c._1; - var _offset = offset + 1 | 0; - while(true) { - var offset$1 = _offset; - var c$1 = _c; - var n = _n; - if (n === 0) { - return [ - c$1, - offset$1 - ]; - } - var cc = classify(Caml_bytes.get(bytes, offset$1)); - if (typeof cc === "number") { - throw { - RE_EXN_ID: "Invalid_argument", - _1: "decode", - Error: new Error() - }; - } - if (cc.TAG === /* Cont */1) { - _offset = offset$1 + 1 | 0; - _c = (c$1 << 6) | cc._0 & 63; - _n = n - 1 | 0; - continue ; - } - throw { - RE_EXN_ID: "Invalid_argument", - _1: "decode", - Error: new Error() - }; - }; - - } -} - -function eq_list(cmp, _xs, _ys) { - while(true) { - var ys = _ys; - var xs = _xs; - if (!xs) { - if (ys) { - return false; - } else { - return true; - } - } - if (!ys) { - return false; - } - if (!Curry._2(cmp, xs.hd, ys.hd)) { - return false; - } - _ys = ys.tl; - _xs = xs.tl; - continue ; - }; -} - -var suites = { - contents: /* [] */0 -}; - -var test_id = { - contents: 0 -}; - -function eq(loc, param) { - var y = param[1]; - var x = param[0]; - test_id.contents = test_id.contents + 1 | 0; - console.log([ - x, - y - ]); - suites.contents = { - hd: [ - loc + (" id " + String(test_id.contents)), - (function (param) { - return { - TAG: /* Eq */0, - _0: x, - _1: y - }; - }) - ], - tl: suites.contents - }; -} - -Stdlib__List.iter((function (param) { - eq("File \"utf8_decode_test.ml\", line 107, characters 7-14", [ - true, - eq_list((function (prim0, prim1) { - return prim0 === prim1; - }), to_list(utf8_decode(Stdlib__Stream.of_string(param[0]))), param[1]) - ]); - }), { - hd: [ - "\xe4\xbd\xa0\xe5\xa5\xbdBuckleScript,\xe6\x9c\x80\xe5\xa5\xbd\xe7\x9a\x84JS\xe8\xaf\xad\xe8\xa8\x80", - { - hd: 20320, - tl: { - hd: 22909, - tl: { - hd: 66, - tl: { - hd: 117, - tl: { - hd: 99, - tl: { - hd: 107, - tl: { - hd: 108, - tl: { - hd: 101, - tl: { - hd: 83, - tl: { - hd: 99, - tl: { - hd: 114, - tl: { - hd: 105, - tl: { - hd: 112, - tl: { - hd: 116, - tl: { - hd: 44, - tl: { - hd: 26368, - tl: { - hd: 22909, - tl: { - hd: 30340, - tl: { - hd: 74, - tl: { - hd: 83, - tl: { - hd: 35821, - tl: { - hd: 35328, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - ], - tl: { - hd: [ - "hello \xe4\xbd\xa0\xe5\xa5\xbd\xef\xbc\x8c\xe4\xb8\xad\xe5\x8d\x8e\xe6\xb0\x91\xe6\x97\x8f hei", - { - hd: 104, - tl: { - hd: 101, - tl: { - hd: 108, - tl: { - hd: 108, - tl: { - hd: 111, - tl: { - hd: 32, - tl: { - hd: 20320, - tl: { - hd: 22909, - tl: { - hd: 65292, - tl: { - hd: 20013, - tl: { - hd: 21326, - tl: { - hd: 27665, - tl: { - hd: 26063, - tl: { - hd: 32, - tl: { - hd: 104, - tl: { - hd: 101, - tl: { - hd: 105, - tl: /* [] */0 - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - ], - tl: /* [] */0 - } - }); - -Mt.from_pair_suites("Utf8_decode_test", suites.contents); - -exports.classify = classify; -exports.utf8_decode = utf8_decode; -exports.to_list = to_list; -exports.utf8_list = utf8_list; -exports.decode = decode; -exports.eq_list = eq_list; -exports.suites = suites; -exports.test_id = test_id; -exports.eq = eq; -/* Not a pure module */