]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Statements/try-004.js
2 * File Name: try-004.js
4 * Description: The try statement
6 * This test has a try with one catch block but no finally.
8 * Author: christine@netscape.com
11 var SECTION
= "try-004";
12 var VERSION
= "ECMA_2";
13 var TITLE
= "The try statement";
16 writeHeaderToLog( SECTION
+ " "+ TITLE
);
19 var testcases
= new Array();
21 TryToCatch( "Math.PI", Math
.PI
);
22 TryToCatch( "Thrower(5)", "Caught 5" );
23 TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
27 function Thrower( v
) {
32 * Evaluate a string. Catch any exceptions thrown. If no exception is
33 * expected, verify the result of the evaluation. If an exception is
34 * expected, verify that we got the right exception.
37 function TryToCatch( value
, expect
) {
39 result
= eval( value
);
44 testcases
[tc
++] = new TestCase(
46 "eval( " + value
+" )",