Ioanna M Dimitriou H 437f9a7631
Migrate staging tests for JSON-parse-with-source (#4265)
Co-authored-by: Philip Chimento <pchimento@igalia.com>
Co-authored-by: Ms2ger <Ms2ger@igalia.com>
2024-11-06 16:59:30 +01:00

26 lines
741 B
JavaScript

// Copyright (C) 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-json.israwjson
description: Basic functionality of JSON.isRawJSON()
info: |
JSON.isRawJSON ( O )
1. If Type(O) is Object and O has an [[IsRawJSON]] internal slot, return true.
2. Return false.
features: [json-parse-with-source]
---*/
const values = [1, 1.1, null, false, true, '123'];
for (const value of values) {
assert(!JSON.isRawJSON(value));
assert(JSON.isRawJSON(JSON.rawJSON(value)));
}
assert(!JSON.isRawJSON(undefined));
assert(!JSON.isRawJSON(Symbol('123')));
assert(!JSON.isRawJSON([]));
assert(!JSON.isRawJSON({}));
assert(!JSON.isRawJSON({ rawJSON: '123' }));