1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/js1_5/extensions/regress-564577.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,91 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* 1.6 + * Any copyright is dedicated to the Public Domain. 1.7 + * http://creativecommons.org/licenses/publicdomain/ 1.8 + * Contributor: Matthew Draper <matthew@trebex.net> 1.9 + */ 1.10 + 1.11 +var gTestfile = 'regress-564577.js'; 1.12 +//----------------------------------------------------------------------------- 1.13 +var BUGNUMBER = 564577; 1.14 +var summary = '__noSuchMethod__ when property exists'; 1.15 +var actual = ''; 1.16 +var expect = ''; 1.17 + 1.18 + 1.19 +//----------------------------------------------------------------------------- 1.20 +test(); 1.21 +//----------------------------------------------------------------------------- 1.22 + 1.23 +function test() 1.24 +{ 1.25 + enterFunc ('test'); 1.26 + printBugNumber(BUGNUMBER); 1.27 + printStatus (summary); 1.28 + 1.29 + 1.30 + var o = { 1.31 + aaa: undefined, 1.32 + bbb: null, 1.33 + ccc: 77, 1.34 + ddd: 'foo', 1.35 + eee: {}, 1.36 + fff: /./, 1.37 + __noSuchMethod__: function (id, args) 1.38 + { 1.39 + return(id + '('+args.join(',')+') ' + this[id]); 1.40 + } 1.41 + }; 1.42 + 1.43 + status = summary + ' ' + inSection(1) + ' '; 1.44 + actual = o.aaa(); 1.45 + expect = 'aaa() undefined'; 1.46 + reportCompare(expect, actual, status); 1.47 + 1.48 + status = summary + ' ' + inSection(2) + ' '; 1.49 + try { 1.50 + actual = o.bbb(); 1.51 + } catch(e) { 1.52 + actual = e + ''; 1.53 + } 1.54 + expect = 'TypeError: o.bbb is not a function'; 1.55 + reportCompare(expect, actual, status); 1.56 + 1.57 + status = summary + ' ' + inSection(3) + ' '; 1.58 + try { 1.59 + actual = o.ccc(); 1.60 + } catch(e) { 1.61 + actual = e + ''; 1.62 + } 1.63 + expect = 'TypeError: o.ccc is not a function'; 1.64 + reportCompare(expect, actual, status); 1.65 + 1.66 + status = summary + ' ' + inSection(4) + ' '; 1.67 + try { 1.68 + actual = o.ddd(); 1.69 + } catch(e) { 1.70 + actual = e + ''; 1.71 + } 1.72 + expect = 'TypeError: o.ddd is not a function'; 1.73 + reportCompare(expect, actual, status); 1.74 + 1.75 + status = summary + ' ' + inSection(5) + ' '; 1.76 + try { 1.77 + actual = o.eee(); 1.78 + } catch(e) { 1.79 + actual = e + ''; 1.80 + } 1.81 + expect = 'TypeError: o.eee is not a function'; 1.82 + reportCompare(expect, actual, status); 1.83 + 1.84 + status = summary + ' ' + inSection(6) + ' '; 1.85 + try { 1.86 + actual = o.fff('xyz') + ''; 1.87 + } catch(e) { 1.88 + actual = e + ''; 1.89 + } 1.90 + expect = 'TypeError: o.fff is not a function'; 1.91 + reportCompare(expect, actual, status); 1.92 + 1.93 + exitFunc('test'); 1.94 +}