test262/test/built-ins/Atomics/load/non-shared-int-views-throws.js

20 lines
621 B
JavaScript
Raw Normal View History

2020-05-20 20:16:53 +02:00
// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
2017-07-26 23:49:55 +02:00
esid: sec-atomics.load
description: >
Atomics.load throws when operating on non-sharable integer TypedArrays
includes: [testTypedArray.js]
features: [ArrayBuffer, Atomics, TypedArray]
---*/
const buffer = new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4);
testWithNonShareableTypedArrayConstructors(function(TA) {
const view = new TA(buffer);
2018-05-18 21:00:10 +02:00
assert.throws(TypeError, function() {
Atomics.load(view, 0);
2020-05-13 22:40:38 +02:00
}, `Atomics.load(new ${TA.name}(buffer), 0) throws TypeError`);
});