Commit b424baba authored by Philip Chimento's avatar Philip Chimento Committed by V8 LUCI CQ

[test] Fix test that was accidentally never executed

This test somehow ended up inside an assertThrows arrow function, after
the expression that was supposed to throw -- so it never got executed
(and the expectation was slightly off.) This moves the test outside the
arrow function so it gets executed, and fixes the expectation.

Justification for changing the expectation: rab is [0, 1, 2, 3, ... 9],
and length_tracking_ta_with_offset2 has an offset of 2, so it is [2, 3,
...]. During the loop, after 2 iterations which have produced [2, 3], we
resize the buffer so the array has length 0. Therefore, the iteration
ends after producing [2, 3], not [3, 4].

Change-Id: Iec6024fb955102841b45f033de3fed80b7d2af34
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3878244Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Auto-Submit: Philip Chimento <ptomato@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83009}
parent 11d3a9ea
......@@ -978,18 +978,18 @@ function TestIterationAndResize(ta, expected, rab, resize_after,
// Length-tracking TA appears detached when the buffer is resized beyond the
// offset.
rab = CreateRab(buffer_byte_length, ctor);
const length_tracking_ta_with_offset = new ctor(rab, byte_offset);
const length_tracking_ta_with_offset1 = new ctor(rab, byte_offset);
assertThrows(() => {
TestIterationAndResize(length_tracking_ta_with_offset, null, rab, 2,
TestIterationAndResize(length_tracking_ta_with_offset1, null, rab, 2,
byte_offset / 2);
});
// Length-tracking TA reduces its length gracefully when the buffer is
// resized to barely cover the offset.
rab = CreateRab(buffer_byte_length, ctor);
const length_tracking_ta_with_offset = new ctor(rab, byte_offset);
TestIterationAndResize(length_tracking_ta_with_offset, [3, 4], rab, 2,
const length_tracking_ta_with_offset2 = new ctor(rab, byte_offset);
TestIterationAndResize(length_tracking_ta_with_offset2, [2, 3], rab, 2,
byte_offset);
});
}
}());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment