mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:56:57 +00:00
fc1b1ecc71
Change-Id: Idbcc965a27e9ffeedf5e0a1068b019de4193070f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/127745 Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
19 lines
324 B
Dart
19 lines
324 B
Dart
import 'dart:collection';
|
|
import 'package:expect/expect.dart';
|
|
|
|
class MyList extends ListBase {
|
|
int get length => 4;
|
|
set length(int x) {}
|
|
int operator [](int x) => 42;
|
|
void operator []=(int x, val) {}
|
|
}
|
|
|
|
main() {
|
|
var x = new MyList();
|
|
int z = 0;
|
|
x.forEach((y) {
|
|
z += y;
|
|
});
|
|
Expect.equals(z, 4 * 42);
|
|
}
|