Skip to content

Commit

Permalink
more test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Hongbo Zhang committed Aug 8, 2016
1 parent 8f47d75 commit 6b59211
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 4 deletions.
99 changes: 98 additions & 1 deletion jscomp/test/test_trywith.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,102 @@
'use strict';

var Caml_builtin_exceptions = require("../../lib/js/caml_builtin_exceptions");
var Curry = require("../../lib/js/curry");

function ff(g, x) {
try {
Curry._1(g, x);
}
catch (exn){
if (exn !== Caml_builtin_exceptions.not_found) {
throw exn;
}

}
try {
Curry._1(g, x);
}
catch (exn$1){
if (exn$1 !== Caml_builtin_exceptions.out_of_memory) {
throw exn$1;
}

}
try {
Curry._1(g, x);
}
catch (exn$2){
if (exn$2[0] !== Caml_builtin_exceptions.sys_error) {
throw exn$2;
}

}
try {
Curry._1(g, x);
}
catch (exn$3){
if (exn$3[0] !== Caml_builtin_exceptions.invalid_argument) {
throw exn$3;
}

}
try {
Curry._1(g, x);
}
catch (exn$4){
if (exn$4 !== Caml_builtin_exceptions.end_of_file) {
throw exn$4;
}

}
try {
Curry._1(g, x);
}
catch (exn$5){
if (exn$5[0] !== Caml_builtin_exceptions.match_failure) {
throw exn$5;
}

}
try {
Curry._1(g, x);
}
catch (exn$6){
if (exn$6 !== Caml_builtin_exceptions.stack_overflow) {
throw exn$6;
}

}
try {
Curry._1(g, x);
}
catch (exn$7){
if (exn$7 !== Caml_builtin_exceptions.sys_blocked_io) {
throw exn$7;
}

}
try {
Curry._1(g, x);
}
catch (exn$8){
if (exn$8[0] !== Caml_builtin_exceptions.assert_failure) {
throw exn$8;
}

}
try {
return Curry._1(g, x);
}
catch (exn$9){
if (exn$9[0] === Caml_builtin_exceptions.undefined_recursive_module) {
return /* () */0;
}
else {
throw exn$9;
}
}
}

function u() {
throw Caml_builtin_exceptions.not_found;
Expand All @@ -19,7 +115,7 @@ function f(x) {
Caml_builtin_exceptions.assert_failure,
[
"test_trywith.ml",
24,
51,
9
]
];
Expand All @@ -33,6 +129,7 @@ var u1 = "bad character decimal encoding \\";

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

exports.ff = ff;
exports.u = u;
exports.u1 = u1;
exports.v = v;
Expand Down
33 changes: 30 additions & 3 deletions jscomp/test/test_trywith.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
let f g x =
try g x
with Not_found -> 0
let ff g x =
(
try g x
with Not_found -> ());
(try g x
with
Out_of_memory -> ();
);
(try g x
with
Sys_error _ -> ();
);
(try g x with
Invalid_argument _ -> ();
);
(try g x with
End_of_file -> () );
(try g x with
Match_failure _ -> ()
);
(try g x with
|Stack_overflow -> () ) ;
(try g x with
Sys_blocked_io -> () );

(try g x with
Assert_failure _ -> () );
(try g x with
Undefined_recursive_module _ -> () )


[@@@warning "-21"]

Expand Down

0 comments on commit 6b59211

Please sign in to comment.