-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathexception_rebound_err_test.js
94 lines (82 loc) · 2.09 KB
/
exception_rebound_err_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
var Mt = require("./mt.js");
var Curry = require("../../lib/js/curry.js");
var Caml_exceptions = require("../../lib/js/caml_exceptions.js");
var Caml_js_exceptions = require("../../lib/js/caml_js_exceptions.js");
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: x,
_1: y
};
})
],
tl: suites.contents
};
}
var A = /* @__PURE__ */Caml_exceptions.create("Exception_rebound_err_test.A");
var B = /* @__PURE__ */Caml_exceptions.create("Exception_rebound_err_test.B");
var C = /* @__PURE__ */Caml_exceptions.create("Exception_rebound_err_test.C");
function test_js_error4(param) {
try {
JSON.parse(" {\"x\"}");
return 1;
}
catch (raw_e){
var e = Caml_js_exceptions.internalToOCamlException(raw_e);
if (e.RE_EXN_ID === "Not_found") {
return 2;
}
if (e.RE_EXN_ID === "Invalid_argument" && e._1 === "x") {
return 3;
}
if (e.RE_EXN_ID === A) {
if (e._1 !== 2) {
return 7;
} else {
return 4;
}
} else if (e.RE_EXN_ID === B) {
return 5;
} else if (e.RE_EXN_ID === C && !(e._1 !== 1 || e._2 !== 2)) {
return 6;
} else {
return 7;
}
}
}
function f(g) {
try {
return Curry._1(g, undefined);
}
catch (raw_exn){
var exn = Caml_js_exceptions.internalToOCamlException(raw_exn);
if (exn.RE_EXN_ID === "Not_found") {
return 1;
}
throw exn;
}
}
eq("File \"exception_rebound_err_test.res\", line 31, characters 3-10", test_js_error4(undefined), 7);
Mt.from_pair_suites("Exception_rebound_err_test", suites.contents);
exports.suites = suites;
exports.test_id = test_id;
exports.eq = eq;
exports.A = A;
exports.B = B;
exports.C = C;
exports.test_js_error4 = test_js_error4;
exports.f = f;
/* Not a pure module */