js/src/tests/ecma_5/JSON/stringify-dropping-elements.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_5/JSON/stringify-dropping-elements.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +// Ported from dom/src/json/test/unit/test_dropping_elements_in_stringify.js
     1.5 +
     1.6 +assertEq(JSON.stringify({foo: 123}),
     1.7 +         '{"foo":123}');
     1.8 +assertEq(JSON.stringify({foo: 123, bar: function () {}}),
     1.9 +         '{"foo":123}');
    1.10 +assertEq(JSON.stringify({foo: 123, bar: function () {}, baz: 123}),
    1.11 +         '{"foo":123,"baz":123}');
    1.12 +
    1.13 +assertEq(JSON.stringify([123]),
    1.14 +         '[123]');
    1.15 +assertEq(JSON.stringify([123, function () {}]),
    1.16 +         '[123,null]');
    1.17 +assertEq(JSON.stringify([123, function () {}, 456]),
    1.18 +         '[123,null,456]');
    1.19 +
    1.20 +/******************************************************************************/
    1.21 +
    1.22 +if (typeof reportCompare === "function")
    1.23 +  reportCompare(true, true);
    1.24 +
    1.25 +print("Tests complete");

mercurial