Debian Codegraph @

js/src/tests/test262/built-ins/JSON/parse/S15.12.2_A1.js

raw
1 // Copyright 2011 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: JSON.parse must create a property with the given property name
6 es5id: 15.12.2_A1
7 description: Tests that JSON.parse treats "__proto__" as a regular property name
8 ---*/
9
10 var x = JSON.parse('{"__proto__":[]}');
11
12 assert.sameValue(
13 Object.getPrototypeOf(x),
14 Object.prototype,
15 'Object.getPrototypeOf("JSON.parse(\'{"__proto__":[]}\')") returns Object.prototype'
16 );
17
18 assert(Array.isArray(x.__proto__), 'Array.isArray(x.__proto__) must return true');
19
20 reportCompare(0, 0);