Skip to content

Commit 6b59211

Browse files
author
Hongbo Zhang
committed
more test case
1 parent 8f47d75 commit 6b59211

File tree

2 files changed

+128
-4
lines changed

2 files changed

+128
-4
lines changed

jscomp/test/test_trywith.js

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,102 @@
11
'use strict';
22

33
var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions");
4+
var Curry = require("../../lib/js/curry");
5+
6+
function ff(g, x) {
7+
try {
8+
Curry._1(g, x);
9+
}
10+
catch (exn){
11+
if (exn !== Caml_builtin_exceptions.not_found) {
12+
throw exn;
13+
}
14+
15+
}
16+
try {
17+
Curry._1(g, x);
18+
}
19+
catch (exn$1){
20+
if (exn$1 !== Caml_builtin_exceptions.out_of_memory) {
21+
throw exn$1;
22+
}
23+
24+
}
25+
try {
26+
Curry._1(g, x);
27+
}
28+
catch (exn$2){
29+
if (exn$2[0] !== Caml_builtin_exceptions.sys_error) {
30+
throw exn$2;
31+
}
32+
33+
}
34+
try {
35+
Curry._1(g, x);
36+
}
37+
catch (exn$3){
38+
if (exn$3[0] !== Caml_builtin_exceptions.invalid_argument) {
39+
throw exn$3;
40+
}
41+
42+
}
43+
try {
44+
Curry._1(g, x);
45+
}
46+
catch (exn$4){
47+
if (exn$4 !== Caml_builtin_exceptions.end_of_file) {
48+
throw exn$4;
49+
}
50+
51+
}
52+
try {
53+
Curry._1(g, x);
54+
}
55+
catch (exn$5){
56+
if (exn$5[0] !== Caml_builtin_exceptions.match_failure) {
57+
throw exn$5;
58+
}
59+
60+
}
61+
try {
62+
Curry._1(g, x);
63+
}
64+
catch (exn$6){
65+
if (exn$6 !== Caml_builtin_exceptions.stack_overflow) {
66+
throw exn$6;
67+
}
68+
69+
}
70+
try {
71+
Curry._1(g, x);
72+
}
73+
catch (exn$7){
74+
if (exn$7 !== Caml_builtin_exceptions.sys_blocked_io) {
75+
throw exn$7;
76+
}
77+
78+
}
79+
try {
80+
Curry._1(g, x);
81+
}
82+
catch (exn$8){
83+
if (exn$8[0] !== Caml_builtin_exceptions.assert_failure) {
84+
throw exn$8;
85+
}
86+
87+
}
88+
try {
89+
return Curry._1(g, x);
90+
}
91+
catch (exn$9){
92+
if (exn$9[0] === Caml_builtin_exceptions.undefined_recursive_module) {
93+
return /* () */0;
94+
}
95+
else {
96+
throw exn$9;
97+
}
98+
}
99+
}
4100

5101
function u() {
6102
throw Caml_builtin_exceptions.not_found;
@@ -19,7 +115,7 @@ function f(x) {
19115
Caml_builtin_exceptions.assert_failure,
20116
[
21117
"test_trywith.ml",
22-
24,
118+
51,
23119
9
24120
]
25121
];
@@ -33,6 +129,7 @@ var u1 = "bad character decimal encoding \\";
33129

34130
var v = "bad character decimal encoding \\%c%c%c";
35131

132+
exports.ff = ff;
36133
exports.u = u;
37134
exports.u1 = u1;
38135
exports.v = v;

jscomp/test/test_trywith.ml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
1-
let f g x =
2-
try g x
3-
with Not_found -> 0
1+
let ff g x =
2+
(
3+
try g x
4+
with Not_found -> ());
5+
(try g x
6+
with
7+
Out_of_memory -> ();
8+
);
9+
(try g x
10+
with
11+
Sys_error _ -> ();
12+
);
13+
(try g x with
14+
Invalid_argument _ -> ();
15+
);
16+
(try g x with
17+
End_of_file -> () );
18+
(try g x with
19+
Match_failure _ -> ()
20+
);
21+
(try g x with
22+
|Stack_overflow -> () ) ;
23+
(try g x with
24+
Sys_blocked_io -> () );
25+
26+
(try g x with
27+
Assert_failure _ -> () );
28+
(try g x with
29+
Undefined_recursive_module _ -> () )
30+
431

532
[@@@warning "-21"]
633

0 commit comments

Comments
 (0)