michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 252892; michael@0: var summary = 'for (var i in o) in heavyweight function f should define i in f\'s activation'; michael@0: var actual = ''; michael@0: var expect = ''; michael@0: michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: var status; michael@0: michael@0: var dodis; michael@0: michael@0: function f1(o){for(var x in o)printStatus(o[x]); return x} michael@0: function f2(o){with(this)for(var x in o)printStatus(o[x]); return x} michael@0: function f2novar(o){with(this)for(x in o)printStatus(o[x]); return x} michael@0: function f3(i,o){for(var x=i in o)printStatus(o[x]); return x} michael@0: function f4(i,o){with(this)for(var x=i in o)printStatus(o[x]); return x} michael@0: michael@0: var t=0; michael@0: function assert(c) michael@0: { michael@0: ++t; michael@0: michael@0: status = summary + ' ' + inSection(t); michael@0: expect = true; michael@0: actual = c; michael@0: michael@0: if (!c) michael@0: { michael@0: printStatus(t + " FAILED!"); michael@0: } michael@0: reportCompare(expect, actual, summary); michael@0: } michael@0: michael@0: assert(f1([]) == undefined); michael@0: michael@0: assert(f1(['first']) == 0); michael@0: michael@0: assert(f2([]) == undefined); michael@0: michael@0: assert(f2(['first']) == 0); michael@0: michael@0: assert(f3(42, []) == 42); michael@0: michael@0: assert(f3(42, ['first']) == 0); michael@0: michael@0: assert(f4(42, []) == 42); michael@0: michael@0: assert(f4(42, ['first']) == 0); michael@0: michael@0: this.x = 41; michael@0: michael@0: assert(f2([]) == undefined); michael@0: michael@0: assert(f2novar([]) == 41); michael@0: michael@0: assert(f2(['first']) == undefined); michael@0: michael@0: assert(f2novar(['first']) == 0);