michael@0: /* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * Contributor: Blake Kaplan michael@0: */ michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 520572; michael@0: var summary = 'watch should innerize the object being watched'; michael@0: var actual = 0; michael@0: var expect = 2; michael@0: michael@0: michael@0: //----------------------------------------------------------------------------- michael@0: test(); michael@0: //----------------------------------------------------------------------------- michael@0: michael@0: function test() michael@0: { michael@0: enterFunc ('test'); michael@0: printBugNumber(BUGNUMBER); michael@0: printStatus (summary); michael@0: michael@0: if ("evalcx" in this) { michael@0: // shell michael@0: let s = evalcx("lazy"); michael@0: s.n = 0; michael@0: evalcx('this.watch("x", function(){ n++; }); this.x = 4; x = 6', s); michael@0: actual = s.n; michael@0: reportCompare(expect, actual, summary); michael@0: } else { michael@0: // browser michael@0: this.watch('x', function(){ actual++; }); michael@0: this.x = 4; michael@0: x = 6; michael@0: reportCompare(expect, actual, summary); michael@0: } michael@0: michael@0: exitFunc ('test'); michael@0: }