Debian Codegraph @

js/src/tests/test262/built-ins/JSON/parse/reviver-call-order.js

raw
1 // Copyright 2019 Kevin Gibbons. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-internalizejsonproperty
6 description: JSON.parse reviver call order
7 features: [for-in-order]
8 includes: [compareArray.js]
9 ---*/
10
11 var calls = [];
12 function reviver(name, val) {
13 calls.push(name);
14 return val;
15 }
16
17 JSON.parse('{"p1":0,"p2":0,"p1":0,"2":0,"1":0}', reviver);
18
19 // The empty string is the _rootName_ in JSON.parse
20 assert.compareArray(calls, ['1', '2', 'p1', 'p2', '']);
21
22 reportCompare(0, 0);