js/src/tests/ecma_5/extensions/function-definition-with.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // |reftest| skip-if(!xulRuntime.shell) -- needs evaluate()
     2 /*
     3  * Any copyright is dedicated to the Public Domain.
     4  * http://creativecommons.org/licenses/publicdomain/
     5  */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 577325;
     9 var summary = 'Implement the ES5 algorithm for processing function statements';
    11 print(BUGNUMBER + ": " + summary);
    13 /**************
    14  * BEGIN TEST *
    15  **************/
    17 var called, obj;
    19 function inFile1() { return "in file"; }
    20 called = false;
    21 obj = { set inFile1(v) { called = true; } };
    22 with (obj)
    23   function inFile1() { return "in file in with"; };
    24 assertEq(inFile1(), "in file in with");
    25 assertEq("set" in Object.getOwnPropertyDescriptor(obj, "inFile1"), true);
    26 assertEq(called, false);
    28 evaluate("function notInFile1() { return 'not in file'; }");
    29 called = false;
    30 obj = { set notInFile1(v) { called = true; return "not in file 2"; } };
    31 with (obj)
    32   function notInFile1() { return "not in file in with"; };
    33 assertEq(notInFile1(), "not in file in with");
    34 assertEq("set" in Object.getOwnPropertyDescriptor(obj, "notInFile1"), true);
    35 assertEq(called, false);
    37 function inFile2() { return "in file 1"; }
    38 called = false;
    39 obj =
    40   Object.defineProperty({}, "inFile2",
    41                         { value: 42, configurable: false, enumerable: false });
    42 with (obj)
    43   function inFile2() { return "in file 2"; };
    44 assertEq(inFile2(), "in file 2");
    45 assertEq(obj.inFile2, 42);
    48 /******************************************************************************/
    50 if (typeof reportCompare === "function")
    51   reportCompare(true, true);
    53 print("All tests passed!");

mercurial