~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/JavaScriptCore/tests/mozilla/ecma_2/Exceptions/lexical-006.js

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
    File Name:          lexical-006.js
 
3
    Corresponds To:     7.4.2-1.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
    Keyword :: one of
 
13
     break          for         new         var
 
14
     continue       function    return      void
 
15
     delete         if          this        while
 
16
     else           in          typeof      with
 
17
 
 
18
    This test verifies that the keyword cannot be used as an identifier.
 
19
    Functioinal tests of the keyword may be found in the section corresponding
 
20
    to the function of the keyword.
 
21
 
 
22
    Author:             christine@netscape.com
 
23
    Date:               12 november 1997
 
24
 
 
25
*/
 
26
    var SECTION = "lexical-006";
 
27
    var VERSION = "JS1_4";
 
28
    var TITLE   = "Keywords";
 
29
 
 
30
    startTest();
 
31
    writeHeaderToLog( SECTION + " "+ TITLE);
 
32
 
 
33
    var tc = 0;
 
34
    var testcases = new Array();
 
35
 
 
36
    var result = "Failed";
 
37
    var exception = "No exception thrown";
 
38
    var expect = "Passed";
 
39
 
 
40
    try {
 
41
        eval("break = new Object();");
 
42
    } catch ( e ) {
 
43
        result = expect;
 
44
        exception = e.toString();
 
45
    }
 
46
 
 
47
    testcases[tc++] = new TestCase(
 
48
        SECTION,
 
49
        "break = new Object()" +
 
50
        " (threw " + exception +")",
 
51
        expect,
 
52
        result );
 
53
 
 
54
    test();
 
55