|
1 // Any copyright is dedicated to the Public Domain. |
|
2 // http://creativecommons.org/licenses/publicdomain/ |
|
3 |
|
4 var gTestfile = 'stringify-ignore-noncallable-toJSON.js'; |
|
5 //----------------------------------------------------------------------------- |
|
6 var BUGNUMBER = 584909; |
|
7 var summary = "If the toJSON property isn't callable, don't try to call it"; |
|
8 |
|
9 print(BUGNUMBER + ": " + summary); |
|
10 |
|
11 /************** |
|
12 * BEGIN TEST * |
|
13 **************/ |
|
14 |
|
15 var obj = |
|
16 { |
|
17 p: { toJSON: null }, |
|
18 m: { toJSON: {} } |
|
19 }; |
|
20 |
|
21 assertEq(JSON.stringify(obj), '{"p":{"toJSON":null},"m":{"toJSON":{}}}'); |
|
22 |
|
23 /******************************************************************************/ |
|
24 |
|
25 if (typeof reportCompare === "function") |
|
26 reportCompare(true, true); |
|
27 |
|
28 print("Tests complete"); |