mirror of
https://github.com/tc39/test262.git
synced 2025-07-31 01:44:54 +02:00
wellKnownIntrinsicObjects.js now exposes a getWellKnownIntrinsicObject() function which returns the object corresponding to a key like %Array%. If the object is not provided by the implementation, or not accessible, it throws a Test262Error. This is so that tests depending on that intrinsic object can easily fail.
22 lines
722 B
JavaScript
22 lines
722 B
JavaScript
// Copyright (C) 2025 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
description: Basic tests for getWellKnownIntrinsicObject harness function
|
|
includes: [wellKnownIntrinsicObjects.js]
|
|
---*/
|
|
|
|
// Accessible in every implementation
|
|
var intrinsicArray = getWellKnownIntrinsicObject('%Array%');
|
|
assert(Object.is(Array, intrinsicArray));
|
|
|
|
assert.throws(Test262Error, function () {
|
|
// Exists but is not accessible in any implementation
|
|
getWellKnownIntrinsicObject('%AsyncFromSyncIteratorPrototype%');
|
|
});
|
|
|
|
assert.throws(Test262Error, function () {
|
|
// Does not exist in any implementation
|
|
getWellKnownIntrinsicObject('%NotSoWellKnownIntrinsicObject%');
|
|
});
|