15792df87e
Change-Id: Ic954a7e20062aa8bf1c0f622ee9b0656bc563ba5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375024 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com>
35 lines
1.3 KiB
Dart
35 lines
1.3 KiB
Dart
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:_foreign_helper' show ArrayFlags, HArrayFlagsCheck;
|
|
import 'dart:typed_data';
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
void rub(Object object, String message) {
|
|
try {
|
|
// Always fail, using non-standard operation name and verb.
|
|
HArrayFlagsCheck(object, ArrayFlags.unmodifiable,
|
|
ArrayFlags.fixedLengthCheck, 'rub', 'burnish');
|
|
Expect.fail('HArrayFlagsCheck should always throw');
|
|
} catch (e) {
|
|
Expect.equals(message, e.toString());
|
|
}
|
|
}
|
|
|
|
main() {
|
|
rub(const [], "Unsupported operation: 'rub': Cannot burnish a constant list");
|
|
rub(List.unmodifiable([]),
|
|
"Unsupported operation: 'rub': Cannot burnish an unmodifiable list");
|
|
rub(List.filled(0, 0),
|
|
"Unsupported operation: 'rub': Cannot burnish a fixed-length list");
|
|
rub([], "Unsupported operation: 'rub': Cannot burnish a list");
|
|
|
|
rub(Uint8List(10).asUnmodifiableView(),
|
|
"Unsupported operation: 'rub': Cannot burnish an unmodifiable list");
|
|
|
|
rub(ByteData(10).asUnmodifiableView(),
|
|
"Unsupported operation: 'rub': Cannot burnish an unmodifiable ByteData");
|
|
}
|