Forgotten last patch-set for landed CL

The https://dart-review.googlesource.com/c/sdk/+/371100
should have included this change, but I somehow managed
to not include it in the upload.

CoreLibraryReviewExempt: Would have been part of accepted CL
Change-Id: Ia9d133ef753413d4804d04db2478e73709e5e5ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372440
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This commit is contained in:
Lasse R.H. Nielsen 2024-06-20 11:27:53 +00:00 committed by Commit Queue
parent 4908814f3a
commit 001e5b3435

View file

@ -11,10 +11,10 @@ import 'package:expect/variations.dart';
// * `offsetInBytes`
// * `lengthInBytes`
// * `elementSizeInBytes`
@pragma('dart2js:assumeDynamic')
@pragma('dart2js:noInline')
confuse(x) => x;
//
// The new `TypedDataList` has these and the `List` interface.
// Testing that all the typed data types have the members, and that if they
// are lists, their list length matches their typed-data view size.
void test(TypedData data, int bytesPerElement, int lengthInBytes) {
var type = data.runtimeType.toString();
@ -26,6 +26,9 @@ void test(TypedData data, int bytesPerElement, int lengthInBytes) {
if (data is TypedDataList) {
Expect.equals(
lengthInBytes ~/ bytesPerElement, data.length, "$type.length");
} else {
// Only `ByteData` is not a `TypedDataList`.
Expect.type<ByteData>(data);
}
}