tests/auto/qml/ecmascripttests/test262/test/built-ins/JSON/stringify/15.12.3_4-1-3.js
raw| 1 | // Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | es5id: 15.12.3_4-1-3 |
| 6 | description: JSON.stringify a indirectly circular object throws a error |
| 7 | ---*/ |
| 8 | |
| 9 | var obj = { |
| 10 | p1: { |
| 11 | p2: {} |
| 12 | } |
| 13 | }; |
| 14 | obj.p1.p2.prop = obj; |
| 15 | |
| 16 | assert.throws(TypeError, function() { |
| 17 | JSON.stringify(obj); |
| 18 | }); |