Use ecma_op_object_get_property_names for property enumeration in built-ins implementation.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
@@ -52,15 +52,15 @@ empty_object.a = undefined;
|
||||
assert (JSON.stringify (empty_object) == '{}');
|
||||
|
||||
p_object = { "a": 1, "b": true, "c": "foo", "d": null, "e": undefined };
|
||||
assert (JSON.stringify (p_object) == '{"d":null,"c":"foo","b":true,"a":1}');
|
||||
assert (JSON.stringify (p_object) == '{"a":1,"b":true,"c":"foo","d":null}');
|
||||
|
||||
o_object = { "a": new Number(1), "b": new Boolean(true), "c": new String("foo") };
|
||||
assert (JSON.stringify (o_object) == '{"c":"foo","b":true,"a":1}');
|
||||
assert (JSON.stringify (o_object) == '{"a":1,"b":true,"c":"foo"}');
|
||||
|
||||
child = { "a": 1, "b": new String("\nfoo"), "c": undefined };
|
||||
parent = { "a": true, "b": child, "c": null};
|
||||
|
||||
assert (JSON.stringify (parent) == '{"c":null,"b":{"b":"\\nfoo","a":1},"a":true}');
|
||||
assert (JSON.stringify (parent) == '{"a":true,"b":{"a":1,"b":"\\nfoo"},"c":null}');
|
||||
|
||||
recursive_object = {};
|
||||
recursive_object.a = 2;
|
||||
@@ -105,13 +105,13 @@ try {
|
||||
}
|
||||
|
||||
object = {"a": 1, "b": [1, true, {"a": "foo"}]};
|
||||
assert (JSON.stringify (object) == '{"b":[1,true,{"a":"foo"}],"a":1}');
|
||||
assert (JSON.stringify (object) == '{"a":1,"b":[1,true,{"a":"foo"}]}');
|
||||
|
||||
object = {"a": [1], "b": {}};
|
||||
assert (JSON.stringify(object) === '{"b":{},"a":[1]}');
|
||||
assert (JSON.stringify(object) === '{"a":[1],"b":{}}');
|
||||
|
||||
array = [1, {"a": 2, "b": true, c: [3]}];
|
||||
assert (JSON.stringify (array) == '[1,{"c":[3],"b":true,"a":2}]');
|
||||
assert (JSON.stringify (array) == '[1,{"a":2,"b":true,"c":[3]}]');
|
||||
|
||||
// Filtering / replacing
|
||||
to_json_object = {};
|
||||
@@ -128,7 +128,7 @@ function replacer_function (key, value)
|
||||
}
|
||||
|
||||
object = { "a": "JSON", "b": new String("JSON"), "c": 3 };
|
||||
assert (JSON.stringify (object, replacer_function) == '{"c":3,"b":"JSON","a":"FOO"}');
|
||||
assert (JSON.stringify (object, replacer_function) == '{"a":"FOO","b":"JSON","c":3}');
|
||||
|
||||
filter = ["a", "b"];
|
||||
assert (JSON.stringify (object, filter) == '{"a":"JSON","b":"JSON"}');
|
||||
@@ -198,7 +198,7 @@ assert (JSON.stringify (array, null, 100) == '[\n 2\n]');
|
||||
assert (JSON.stringify (array, null, -5) == '[2]');
|
||||
|
||||
nested_object = {"a": 2, "b": {"c": 1, "d": true}};
|
||||
assert (JSON.stringify (nested_object, null, 2) == '{\n "b": {\n "d": true,\n "c": 1\n },\n "a": 2\n}');
|
||||
assert (JSON.stringify (nested_object, null, 2) == '{\n "a": 2,\n "b": {\n "c": 1,\n "d": true\n }\n}');
|
||||
|
||||
nested_array = [2, [1,true]];
|
||||
assert (JSON.stringify (nested_array, null, 2) == '[\n 2,\n [\n 1,\n true\n ]\n]');
|
||||
|
||||
Reference in New Issue
Block a user