]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Statements/try-005.js
2 * File Name: try-005.js
4 * Description: The try statement
6 * This test has a try with one catch block but no finally. Same
7 * as try-004, but the eval statement is called from a function, not
8 * directly from within the try block.
10 * Author: christine@netscape.com
11 * Date: 11 August 1998
13 var SECTION
= "try-005";
14 var VERSION
= "ECMA_2";
15 var TITLE
= "The try statement";
18 writeHeaderToLog( SECTION
+ " "+ TITLE
);
21 var testcases
= new Array();
23 TryToCatch( "Math.PI", Math
.PI
);
24 TryToCatch( "Thrower(5)", "Caught 5" );
25 TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
29 function Thrower( v
) {
37 * Evaluate a string. Catch any exceptions thrown. If no exception is
38 * expected, verify the result of the evaluation. If an exception is
39 * expected, verify that we got the right exception.
42 function TryToCatch( value
, expect
) {
44 result
= Eval( value
);
49 testcases
[tc
++] = new TestCase(
51 "eval( " + value
+" )",