michael@0: // Any copyright is dedicated to the Public Domain. michael@0: // http://creativecommons.org/licenses/publicdomain/ michael@0: michael@0: var gTestfile = 'stringify-call-toJSON-once.js'; michael@0: //----------------------------------------------------------------------------- michael@0: var BUGNUMBER = 584909; michael@0: var summary = "Stringification of Boolean/String/Number objects"; michael@0: michael@0: print(BUGNUMBER + ": " + summary); michael@0: michael@0: /************** michael@0: * BEGIN TEST * michael@0: **************/ michael@0: michael@0: var obj = michael@0: { michael@0: p: { michael@0: toJSON: function() michael@0: { michael@0: return { toJSON: function() { return 17; } }; michael@0: } michael@0: } michael@0: }; michael@0: michael@0: assertEq(JSON.stringify(obj), '{"p":{}}'); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete");