2 * File Name: try-008.js
4 * Description: The try statement
6 * This test has a try block in a constructor.
9 * Author: christine@netscape.com
10 * Date: 11 August 1998
12 var SECTION = "try-008";
13 var VERSION = "ECMA_2";
14 var TITLE = "The try statement: try in a constructor";
17 writeHeaderToLog( SECTION + " "+ TITLE);
20 var testcases = new Array();
22 function Integer( value, exception ) {
24 this.value = checkValue( value );
26 this.value = e.toString();
29 testcases[tc++] = new TestCase(
31 "Integer( " + value +" )",
32 (exception ? INVALID_INTEGER_VALUE +": " + value : this.value),
36 var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
38 function checkValue( value ) {
39 if ( Math.floor(value) != value || isNaN(value) ) {
40 throw ( INVALID_INTEGER_VALUE +": " + value );
48 new Integer( 3, false );
49 new Integer( NaN, true );
50 new Integer( 0, false );
51 new Integer( Infinity, false );
52 new Integer( -2.12, true );
53 new Integer( Math.LN2, true );