]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Statements/try-009.js
2 * File Name: try-009.js
4 * Description: The try statement
6 * This test has a try block within a while block. Verify that an exception
7 * breaks out of the while. I don't really know why this is an interesting
8 * test case but Mike Shaver had two of these so what the hey.
10 * Author: christine@netscape.com
11 * Date: 11 August 1998
13 var SECTION
= "try-009";
14 var VERSION
= "ECMA_2";
15 var TITLE
= "The try statement: try in a while block";
18 writeHeaderToLog( SECTION
+ " "+ TITLE
);
21 var testcases
= new Array();
23 var EXCEPTION_STRING
= "Exception thrown: ";
24 var NO_EXCEPTION_STRING
= "No exception thrown: ";
27 TryInWhile( new TryObject( "hello", ThrowException
, true ) );
28 TryInWhile( new TryObject( "aloha", NoException
, false ));
32 function TryObject( value
, throwFunction
, result
) {
34 this.thrower
= throwFunction
;
37 function ThrowException() {
38 throw EXCEPTION_STRING
+ this.value
;
40 function NoException() {
41 return NO_EXCEPTION_STRING
+ this.value
;
43 function TryInWhile( object
) {
48 result
= NO_EXCEPTION_STRING
+ object
.value
;
56 testcases
[tc
++] = new TestCase(
58 "( "+ object
+".thrower() )",
60 ? EXCEPTION_STRING
+ object
.value :
61 NO_EXCEPTION_STRING
+ object
.value
),