Home | History | Annotate | Download | only in mjsunit

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);
231 assertEquals("false", JSON.stringify({toJSON: function () { return false; }}));
275 // toJSON get string keys.
278 checker.toJSON = function(key) { return 1 + key; };
375 funcJSON.toJSON = function() { return "has toJSON"; };
380 reJSON.toJSON = function() { return "has toJSON"; };
383 '[37,null,1,"foo","37","true",null,"has toJSON",{},"has toJSON"]',
395 var counter = { get toJSON() { getCount++;
411 toJSON: function () { return oddball3; } }