js/src/jit-test/tests/basic/bug913445.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/basic/bug913445.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +// uneval works on objects with no callable .toSource method.
     1.5 +
     1.6 +var obj = Object.create(null);
     1.7 +assertEq(uneval(obj), "({})");
     1.8 +assertEq(Function.prototype.toSource.call(obj), "({})");
     1.9 +obj.x = 1;
    1.10 +obj.y = 2;
    1.11 +assertEq(uneval(obj), "({x:1, y:2})");
    1.12 +
    1.13 +var d = new Date();
    1.14 +delete Date.prototype.toSource;
    1.15 +assertEq(uneval(d), "({})");
    1.16 +
    1.17 +delete Object.prototype.toSource;
    1.18 +assertEq(uneval({p: 2+2}), "({p:4})");
    1.19 +
    1.20 +assertEq(uneval({toSource: [0]}), "({toSource:[0]})");

mercurial