OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Properties are serialized once. | 5 // Properties are serialized once. |
6 assertEquals('{"x":1}', JSON.stringify({ x : 1 }, ["x", 1, "x", 1])); | 6 assertEquals('{"x":1}', JSON.stringify({ x : 1 }, ["x", 1, "x", 1])); |
7 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["x", 1, "x", 1])); | 7 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["x", 1, "x", 1])); |
8 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["1", 1, "1", 1])); | 8 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, ["1", 1, "1", 1])); |
9 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, [1, "1", 1, "1"])); | 9 assertEquals('{"1":1}', JSON.stringify({ 1 : 1 }, [1, "1", 1, "1"])); |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 assertEquals('{}', | 44 assertEquals('{}', |
45 JSON.stringify({ x : 1, "1": 1 }, [{}])); | 45 JSON.stringify({ x : 1, "1": 1 }, [{}])); |
46 assertEquals('{}', | 46 assertEquals('{}', |
47 JSON.stringify({ x : 1, "1": 1 }, [true, undefined, null])); | 47 JSON.stringify({ x : 1, "1": 1 }, [true, undefined, null])); |
48 assertEquals('{}', | 48 assertEquals('{}', |
49 JSON.stringify({ x : 1, "1": 1 }, | 49 JSON.stringify({ x : 1, "1": 1 }, |
50 [{ toString: function() { return "x";} }])); | 50 [{ toString: function() { return "x";} }])); |
51 assertEquals('{}', | 51 assertEquals('{}', |
52 JSON.stringify({ x : 1, "1": 1 }, | 52 JSON.stringify({ x : 1, "1": 1 }, |
53 [{ valueOf: function() { return 1;} }])); | 53 [{ valueOf: function() { return 1;} }])); |
OLD | NEW |