Lines Matching defs:toJSON
28 // Date toJSON
29 assertEquals("1970-01-01T00:00:00.000Z", new Date(0).toJSON());
30 assertEquals("1979-01-11T08:00:00.000Z", new Date("1979-01-11 08:00 GMT").toJSON());
31 assertEquals("2005-05-05T05:05:05.000Z", new Date("2005-05-05 05:05:05 GMT").toJSON());
34 assertEquals("foo", n1.toJSON());
37 assertThrows(function () { n2.toJSON(); }, TypeError);
44 assertEquals(null, n4.toJSON());
49 //Test Date.prototype.toJSON as generic function.
50 var d1 = {toJSON: Date.prototype.toJSON,
52 assertEquals(42, d1.toJSON());
54 var d2 = {toJSON: Date.prototype.toJSON,
57 assertEquals(null, d2.toJSON());
59 var d3 = {toJSON: Date.prototype.toJSON,
64 assertEquals(null, d3.toJSON());
66 var d4 = {toJSON: Date.prototype.toJSON,
70 assertThrows("d4.toJSON()", TypeError); // ToPrimitive throws.
72 var d5 = {toJSON: Date.prototype.toJSON,
76 assertEquals(42, d5.toJSON());
78 var d6 = {toJSON: Date.prototype.toJSON,
80 assertEquals(["not primitive"], d6.toJSON());
82 var d7 = {toJSON: Date.prototype.toJSON,
84 assertThrows("d7.toJSON()", TypeError);
236 TestStringify("false", {toJSON: function () { return false; }});
271 TestStringify('"toJSON 123"',
272 { toJSON : function() { return 'toJSON 123'; } });
274 { a : { toJSON : function() { return 321; } } });
294 b.__proto__ = { toJSON : function() { return 321;} };
322 // toJSON get string keys.
325 checker.toJSON = function(key) { return 1 + key; };
421 funcJSON.toJSON = function() { return "has toJSON"; };
426 reJSON.toJSON = function() { return "has toJSON"; };
428 TestStringify('[37,null,1,"foo","37","true",null,"has toJSON",{},"has toJSON"]',
440 var counter = { get toJSON() { getCount++;
456 toJSON: function () { return oddball3; } }