tc39 / tc39/test262

Missing coverage: Resizable / Growable (Shared)ArrayBuffers: More combinations for TypedArray.prototype.set

Open
#3,391 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.8k
Forks
564
Avg merge
3d 7h
Merged PRs (30d)
10

Description

There are some tests which pass RAB/GSAB to TypedArray.prototype.set, but those don't seem to cover enough cases. Proof: I now have v8 in a state where all TA.p.set -related test262 tests pass, but there are bugs in the uncovered code paths. :)

At least these seem uncovered:

  1. target is a RAB/GSAB-TA and source is a non-RAB/GSAB TA and the source is not OOB

There is built-ins/TypedArray/prototype/set/typedarray-arg-target-out-of-bounds.js but it doesn't cover this case.

Here's a simple test that currently fails for my impl even though test262 passes:

let a = new Uint8Array(new ArrayBuffer(80, {maxByteLength: 100}));
let a2 = new Uint8Array(new ArrayBuffer(80));
a2.set(a);
  1. target is a non-RAB/GSAB-TA and source is a RAB/GSAB TA (both "source OOB" and "source not OOB" cases would be relevant)

  2. source and target have different element types

  3. SharedArrayBuffers (the existing test only uses ArrayBuffers)

  4. In addition, tests where the resizing happens when getting the length of the arraylike source in https://tc39.es/ecma262/#sec-settypedarrayfromarraylike , or when iterating the arraylike, are missing. But I think I have another open issue for covering those cases for all TA.p. functions.

cc @sarahghp @syg

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with built-ins/TypedArray/prototype/set/typedarray-arg-target-out-of-bounds.js and review the existing TypedArray.prototype.set test coverage in test262. Add tests for RAB/GSAB and non-RAB/GSAB source and target combinations, differing element types, SharedArrayBuffers, and relevant out-of-bounds cases. Done means the listed combinations are covered and the tests pass against compliant implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.