basic.js (763B)
1 // Copyright (C) 2023 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-json.israwjson 6 description: Basic functionality of JSON.isRawJSON() 7 info: | 8 JSON.isRawJSON ( O ) 9 10 1. If Type(O) is Object and O has an [[IsRawJSON]] internal slot, return true. 11 2. Return false. 12 13 features: [json-parse-with-source] 14 ---*/ 15 16 const values = [1, 1.1, null, false, true, '123']; 17 for (const value of values) { 18 assert(!JSON.isRawJSON(value)); 19 assert(JSON.isRawJSON(JSON.rawJSON(value))); 20 } 21 assert(!JSON.isRawJSON(undefined)); 22 assert(!JSON.isRawJSON(Symbol('123'))); 23 assert(!JSON.isRawJSON([])); 24 assert(!JSON.isRawJSON({})); 25 assert(!JSON.isRawJSON({ rawJSON: '123' })); 26 27 reportCompare(0, 0);