Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate resizable buffer tests out of staging #3888

Merged
merged 4 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only new test file in this PR that has not been added by the series of "RAB" PRs referencing this PR.

LGTM!

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-arraybuffer.prototype.resize
description: >
ArrayBuffer.p.resize has one detach check after argument coercion
includes: [detachArrayBuffer.js]
features: [resizable-arraybuffer]
---*/

{
const rab = new ArrayBuffer(64, { maxByteLength: 1024 });
let called = false;
assert.throws(TypeError, () => rab.resize({ valueOf() {
$DETACHBUFFER(rab);
called = true;
}}));
assert(called);
}

{
const rab = new ArrayBuffer(64, { maxByteLength: 1024 });
$DETACHBUFFER(rab);
let called = false;
assert.throws(TypeError, () => rab.resize({ valueOf() {
called = true;
}}));
assert(called);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ includes: [compareArray.js, resizableArrayBufferUtils.js]
features: [resizable-arraybuffer]
---*/


for (let ctor of ctors) {
const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT);
const fixedLength = new ctor(rab, 0, 4);
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was added by PR #4174 under the name test/built-ins/TypedArray/prototype/slice/coerced-start-end-grow.js, so it should be removed from here.

Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Copyright 2021 the V8 project authors. All rights reserved.
// Copyright 2023 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-arraybuffer-length
esid: sec-%typedarray%.prototype.slice
description: >
Automatically ported from SliceParameterConversionGrows test
in V8's mjsunit test typedarray-resizablearraybuffer.js
TypedArray.p.slice behaves correctly when the receiver is backed by
resizable buffer that is grown by argument coercion
includes: [compareArray.js]
features: [resizable-arraybuffer]
flags: [onlyStrict]
---*/

class MyUint8Array extends Uint8Array {
Expand Down Expand Up @@ -72,11 +71,7 @@ const TypedArraySliceHelper = (ta, ...rest) => {
return ta.slice(...rest);
};

const ArraySliceHelper = (ta, ...rest) => {
return Array.prototype.slice.call(ta, ...rest);
};

function SliceParameterConversionGrows(sliceHelper) {
function SliceParameterConversionGrows() {
for (let ctor of ctors) {
const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT);
const lengthTracking = new ctor(rab);
Expand All @@ -89,7 +84,7 @@ function SliceParameterConversionGrows(sliceHelper) {
return 0;
}
};
assert.compareArray(ToNumbers(sliceHelper(lengthTracking, evil)), [
assert.compareArray(ToNumbers(TypedArraySliceHelper(lengthTracking, evil)), [
1,
2,
3,
Expand All @@ -99,5 +94,4 @@ function SliceParameterConversionGrows(sliceHelper) {
}
}

SliceParameterConversionGrows(TypedArraySliceHelper);
SliceParameterConversionGrows(ArraySliceHelper);
SliceParameterConversionGrows();

This file was deleted.

This file was deleted.

Loading
Loading