Home | History | Annotate | Download | only in Exceptions
      1 /**
      2     File Name:          lexical-027.js
      3     Corresponds To:     7.4.2-4-n.js
      4     ECMA Section:       7.4.2
      5 
      6     Description:
      7     The following tokens are ECMAScript keywords and may not be used as
      8     identifiers in ECMAScript programs.
      9 
     10     Syntax
     11 
     12     var
     13 
     14     Keyword :: one of
     15      break          for         new         var
     16      continue       function    return      void
     17      delete         if          this        while
     18      else           in          typeof      with
     19 
     20     This test verifies that the keyword cannot be used as an identifier.
     21     Functioinal tests of the keyword may be found in the section corresponding
     22     to the function of the keyword.
     23 
     24     Author:             christine (at) netscape.com
     25     Date:               12 november 1997
     26 
     27 */
     28     var SECTION = "lexical-027";
     29     var VERSION = "JS1_4";
     30     var TITLE   = "Keywords";
     31 
     32     startTest();
     33     writeHeaderToLog( SECTION + " "+ TITLE);
     34 
     35     var tc = 0;
     36     var testcases = new Array();
     37 
     38     var result = "Failed";
     39     var exception = "No exception thrown";
     40     var expect = "Passed";
     41 
     42     try {
     43         eval("var var;");
     44     } catch ( e ) {
     45         result = expect;
     46         exception = e.toString();
     47     }
     48 
     49     testcases[tc++] = new TestCase(
     50         SECTION,
     51         "var var" +
     52         " (threw " + exception +")",
     53         expect,
     54         result );
     55 
     56     test();
     57 
     58 
     59