mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:21:18 +00:00
e769817cdc
Splitting out a failing test to increase coverage of other tests. It is not clear that `a.addAll(a)` should throw if `a` is empty. `a` is not modified by the action. dart2js/DDC do not detect this case and I'm reluctant to add a check for the case where `a` is in fact not modified. The VM test is very specific to an identical argument and cannot detect the case for `a = Mylist([])`. Another option to this proposal is to simply delete the `[]` case. In general, I'd like to move more ConcurrentModificationError tests into assert statements. Change-Id: I1f9559bdb43ea1bae0575413748c9d9d0de58b99 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170023 Commit-Queue: Stephen Adams <sra@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
18 lines
520 B
Dart
18 lines
520 B
Dart
// Copyright (c) 2020, 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:collection";
|
|
import "dart:typed_data";
|
|
import "package:expect/expect.dart";
|
|
|
|
void main() {
|
|
testConcurrentAddSelf([1, 2, 3]);
|
|
}
|
|
|
|
testConcurrentAddSelf(List list) {
|
|
Expect.throws(() {
|
|
list.addAll(list);
|
|
}, (e) => e is ConcurrentModificationError, "testConcurrentAddSelf($list)");
|
|
}
|