js/src/tests/ecma_5/Boolean/no-boolean-toJSON.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_5/Boolean/no-boolean-toJSON.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +/*
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/licenses/publicdomain/
     1.7 + * Author: Tom Schuster
     1.8 + */
     1.9 +
    1.10 +JSON.stringify(new Boolean(false), function(k, v) { 
    1.11 +    assertEq(typeof v, "object"); 
    1.12 +});
    1.13 +
    1.14 +assertEq(Boolean.prototype.hasOwnProperty('toJSON'), false);
    1.15 +
    1.16 +Object.prototype.toJSON = function() { return 2; };
    1.17 +assertEq(JSON.stringify(new Boolean(true)), "2");
    1.18 +
    1.19 +if (typeof reportCompare === 'function')
    1.20 +    reportCompare(true, true);

mercurial