Debian Codegraph @

js/src/tests/test262/built-ins/JSON/parse/builtin.js

raw
1 // Copyright (C) 2019 Alexey Shvayka. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-json.parse
5 description: >
6 Requirements for built-in functions, defined in introduction of chapter 17,
7 are satisfied.
8 features: [Reflect.construct]
9 ---*/
10
11 var parse = JSON.parse;
12 assert(Object.isExtensible(parse), 'Object.isExtensible(parse) must return true');
13 assert.sameValue(typeof parse, 'function', 'The value of `typeof parse` is "function"');
14 assert.sameValue(
15 Object.prototype.toString.call(parse),
16 '[object Function]',
17 'Object.prototype.toString.call("JSON.parse") must return "[object Function]"'
18 );
19 assert.sameValue(
20 Object.getPrototypeOf(parse),
21 Function.prototype,
22 'Object.getPrototypeOf("JSON.parse") must return the value of Function.prototype'
23 );
24 assert.sameValue(
25 parse.hasOwnProperty('prototype'),
26 false,
27 'parse.hasOwnProperty("prototype") must return false'
28 );
29
30 reportCompare(0, 0);