js/src/tests/js1_6/extensions/regress-414098.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/js1_6/extensions/regress-414098.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,34 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +//-----------------------------------------------------------------------------
    1.10 +var BUGNUMBER = 414098;
    1.11 +var summary = 'Getter behavior on arrays';
    1.12 +var actual = '';
    1.13 +var expect = '';
    1.14 +
    1.15 +var a=[1,2,3];
    1.16 +var foo = 44;
    1.17 +a.__defineGetter__(1, function() { return foo + 10; });
    1.18 +actual = String(a);
    1.19 +reportCompare("1,54,3", actual, "getter 1");
    1.20 +
    1.21 +actual = String(a.reverse());
    1.22 +reportCompare("3,54,1", actual, "reverse");
    1.23 +
    1.24 +var s = "";
    1.25 +a.forEach(function(e) { s += e + "|"; });
    1.26 +actual = s;
    1.27 +reportCompare("3|54|1|", actual, "forEach");
    1.28 +
    1.29 +actual = a.join(' - ');
    1.30 +reportCompare("3 - 54 - 1", actual, "join");
    1.31 +
    1.32 +a[2]=3;
    1.33 +actual = a.pop();
    1.34 +reportCompare(actual, 3, "pop");
    1.35 +
    1.36 +actual = a.pop();
    1.37 +reportCompare(actual, 54, "pop 2");

mercurial