-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathequal_exception_test.js
132 lines (121 loc) · 2.63 KB
/
equal_exception_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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
'use strict';
var Mt = require("./mt.js");
var Bytes = require("../../lib/js/bytes.js");
var Js_exn = require("../../lib/js/js_exn.js");
var Caml_bytes = require("../../lib/js/caml_bytes.js");
var Caml_exceptions = require("../../lib/js/caml_exceptions.js");
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions.js");
var v = "gso";
function is_equal() {
if (Caml_bytes.get(Bytes.make(3, /* "a" */97), 0) !== /* "a" */97) {
throw [
Caml_builtin_exceptions.assert_failure,
[
"equal_exception_test.ml",
9,
4
]
];
}
if (Bytes.make(3, /* "a" */97)[0] !== /* "a" */97) {
throw [
Caml_builtin_exceptions.assert_failure,
[
"equal_exception_test.ml",
10,
4
]
];
}
var u = Bytes.make(3, /* "a" */97);
u[0] = /* "b" */98;
if (u[0] !== /* "b" */98) {
throw [
Caml_builtin_exceptions.assert_failure,
[
"equal_exception_test.ml",
13,
4
]
];
}
return 0;
}
function is_exception() {
try {
throw Caml_builtin_exceptions.not_found;
}
catch (exn){
if (exn === Caml_builtin_exceptions.not_found) {
return /* () */0;
} else {
throw exn;
}
}
}
function is_normal_exception() {
var A = Caml_exceptions.create("A");
var v = [
A,
3
];
try {
throw v;
}
catch (raw_exn){
var exn = Js_exn.internalToOCamlException(raw_exn);
if (exn[0] === A) {
if (exn[1] !== 3) {
throw exn;
} else {
return /* () */0;
}
} else {
throw exn;
}
}
}
function is_arbitrary_exception() {
var A = Caml_exceptions.create("A");
try {
throw A;
}
catch (exn){
return /* () */0;
}
}
var suites_000 = /* tuple */[
"is_equal",
is_equal
];
var suites_001 = /* :: */[
/* tuple */[
"is_exception",
is_exception
],
/* :: */[
/* tuple */[
"is_normal_exception",
is_normal_exception
],
/* :: */[
/* tuple */[
"is_arbitrary_exception",
is_arbitrary_exception
],
/* [] */0
]
]
];
var suites = /* :: */[
suites_000,
suites_001
];
Mt.from_suites("exception", suites);
exports.v = v;
exports.is_equal = is_equal;
exports.is_exception = is_exception;
exports.is_normal_exception = is_normal_exception;
exports.is_arbitrary_exception = is_arbitrary_exception;
exports.suites = suites;
/* Not a pure module */