~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/statement-004.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:          statement-004.js
 
3
    Corresponds To:     12.6.3-1.js
 
4
    ECMA Section:       12.6.3 The for...in Statement
 
5
    Description:
 
6
    Author:             christine@netscape.com
 
7
    Date:               11 september 1997
 
8
*/
 
9
    var SECTION = "statement-004";
 
10
    var VERSION = "JS1_4";
 
11
    var TITLE   = "The for..in statment";
 
12
 
 
13
    startTest();
 
14
    writeHeaderToLog( SECTION + " "+ TITLE);
 
15
 
 
16
    var testcases = new Array();
 
17
    var tc = 0;
 
18
 
 
19
    var result = "Failed";
 
20
    var exception = "No exception thrown";
 
21
    var expect = "Passed";
 
22
 
 
23
    try {
 
24
        var o = new MyObject();
 
25
 
 
26
        eval("for ( \"a\" in o) {\n"
 
27
            + "result += this[p];\n"
 
28
            + "}");
 
29
 
 
30
    } catch ( e ) {
 
31
        result = expect;
 
32
        exception = e.toString();
 
33
    }
 
34
 
 
35
    testcases[tc++] = new TestCase(
 
36
        SECTION,
 
37
        "bad left-hand side expression" +
 
38
        " (threw " + exception +")",
 
39
        expect,
 
40
        result );
 
41
 
 
42
    test();
 
43
 
 
44
 
 
45
function MyObject() {
 
46
    this.value = 2;
 
47
    this[0] = 4;
 
48
    return this;
 
49
}