Home | History | Annotate | Download | only in Exceptions
      1 /**
      2     File Name:          lexical-005.js
      3     Corresponds To:     7.4.1-2.js
      4     ECMA Section:       7.4.1
      5 
      6     Description:
      7 
      8     Reserved words cannot be used as identifiers.
      9 
     10     ReservedWord ::
     11     Keyword
     12     FutureReservedWord
     13     NullLiteral
     14     BooleanLiteral
     15 
     16     Author:             christine (at) netscape.com
     17     Date:               12 november 1997
     18 
     19 */
     20     var SECTION = "lexical-005";
     21     var VERSION = "JS1_4";
     22     var TITLE   = "Keywords";
     23 
     24     startTest();
     25     writeHeaderToLog( SECTION + " "+ TITLE);
     26 
     27     var tc = 0;
     28     var testcases = new Array();
     29 
     30 
     31     var result = "Failed";
     32     var exception = "No exception thrown";
     33     var expect = "Passed";
     34 
     35     try {
     36         eval("true = false;");
     37     } catch ( e ) {
     38         result = expect;
     39         exception = e.toString();
     40     }
     41 
     42     testcases[tc++] = new TestCase(
     43         SECTION,
     44         "true = false" +
     45         " (threw " + exception +")",
     46         expect,
     47         result );
     48 
     49     test();
     50 
     51