summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/JSON/stringify-dropping-elements.js
blob: 58838e10d168f0051396cec747f11967960f21e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
assertEq(JSON.stringify({foo: 123}),
         '{"foo":123}');
assertEq(JSON.stringify({foo: 123, bar: function () {}}),
         '{"foo":123}');
assertEq(JSON.stringify({foo: 123, bar: function () {}, baz: 123}),
         '{"foo":123,"baz":123}');

assertEq(JSON.stringify([123]),
         '[123]');
assertEq(JSON.stringify([123, function () {}]),
         '[123,null]');
assertEq(JSON.stringify([123, function () {}, 456]),
         '[123,null,456]');

/******************************************************************************/

if (typeof reportCompare === "function")
  reportCompare(true, true);

print("Tests complete");