michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/licenses/publicdomain/ michael@0: * Contributor: Matthew Draper michael@0: */ michael@0: michael@0: var gTestfile = 'regress-564577.js'; michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 564577; michael@0: var summary = '__noSuchMethod__ when property exists'; michael@0: var actual = ''; michael@0: var expect = ''; 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: michael@0: var o = { michael@0: aaa: undefined, michael@0: bbb: null, michael@0: ccc: 77, michael@0: ddd: 'foo', michael@0: eee: {}, michael@0: fff: /./, michael@0: __noSuchMethod__: function (id, args) michael@0: { michael@0: return(id + '('+args.join(',')+') ' + this[id]); michael@0: } michael@0: }; michael@0: michael@0: status = summary + ' ' + inSection(1) + ' '; michael@0: actual = o.aaa(); michael@0: expect = 'aaa() undefined'; michael@0: reportCompare(expect, actual, status); michael@0: michael@0: status = summary + ' ' + inSection(2) + ' '; michael@0: try { michael@0: actual = o.bbb(); michael@0: } catch(e) { michael@0: actual = e + ''; michael@0: } michael@0: expect = 'TypeError: o.bbb is not a function'; michael@0: reportCompare(expect, actual, status); michael@0: michael@0: status = summary + ' ' + inSection(3) + ' '; michael@0: try { michael@0: actual = o.ccc(); michael@0: } catch(e) { michael@0: actual = e + ''; michael@0: } michael@0: expect = 'TypeError: o.ccc is not a function'; michael@0: reportCompare(expect, actual, status); michael@0: michael@0: status = summary + ' ' + inSection(4) + ' '; michael@0: try { michael@0: actual = o.ddd(); michael@0: } catch(e) { michael@0: actual = e + ''; michael@0: } michael@0: expect = 'TypeError: o.ddd is not a function'; michael@0: reportCompare(expect, actual, status); michael@0: michael@0: status = summary + ' ' + inSection(5) + ' '; michael@0: try { michael@0: actual = o.eee(); michael@0: } catch(e) { michael@0: actual = e + ''; michael@0: } michael@0: expect = 'TypeError: o.eee is not a function'; michael@0: reportCompare(expect, actual, status); michael@0: michael@0: status = summary + ' ' + inSection(6) + ' '; michael@0: try { michael@0: actual = o.fff('xyz') + ''; michael@0: } catch(e) { michael@0: actual = e + ''; michael@0: } michael@0: expect = 'TypeError: o.fff is not a function'; michael@0: reportCompare(expect, actual, status); michael@0: michael@0: exitFunc('test'); michael@0: }