Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: tests/language_strong/mixin_and_extension_member_test.dart

Issue 2803673007: fix #29233, final fields can be settable in a mock (Closed)
Patch Set: fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:collection';
6 import 'package:expect/expect.dart';
7
8 class OverrideFirstGetter {
9 get first => 9999;
10 }
11
12 class ListMock extends ListBase with OverrideFirstGetter {
13 final _list = [];
14 int get length => _list.length;
15 void set length(int x) {
16 _list.length = x;
17 }
18
19 operator [](x) => _list[x];
20 void operator []=(x, y) {
21 _list[x] = y;
22 }
23 }
24
25 // Regression test for
26 // https://github.com/dart-lang/sdk/issues/29273#issuecomment-292384130
27 main() {
28 List x = new ListMock();
29 x.add(42);
30 Expect.equals(x[0], 42);
31 Expect.equals(x.first, 9999);
32 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698