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

Side by Side Diff: tests/language_strong/covariant_override/runtime_check_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files 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
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 class View { 7 class View {
8 addChild(View v) {} 8 addChild(View v) {}
9 transform(View fn(View v)) {} 9 transform(View fn(View v)) {}
10 } 10 }
11
11 class MyView extends View { 12 class MyView extends View {
12 addChild(covariant MyView v) {} 13 addChild(covariant MyView v) {}
13 transform(covariant MyView fn(Object v)) {} 14 transform(covariant MyView fn(Object v)) {}
14 } 15 }
15 16
16 main() { 17 main() {
17 dynamic mv = new MyView(); 18 dynamic mv = new MyView();
18 dynamic v = new View(); 19 dynamic v = new View();
19 20
20 mv.addChild(mv); 21 mv.addChild(mv);
21 Expect.throws(() => mv.addChild(v)); 22 Expect.throws(() => mv.addChild(v));
22 23
23 mv.transform((_) => new MyView()); 24 mv.transform((_) => new MyView());
24 25
25 // TODO(jmesserly): these *should* be cast failures, but DDC is currently 26 // TODO(jmesserly): these *should* be cast failures, but DDC is currently
26 // ignoring function type failures w/ a warning at the console... 27 // ignoring function type failures w/ a warning at the console...
27 28
28 // * -> * not a subtype of Object -> MyView 29 // * -> * not a subtype of Object -> MyView
29 // Expect.throws(() => mv.transform((_) => mv)); 30 // Expect.throws(() => mv.transform((_) => mv));
30 31
31 // View -> View not a subtype of Object -> MyView 32 // View -> View not a subtype of Object -> MyView
32 // Expect.throws(() => mv.transform((View x) => x)); 33 // Expect.throws(() => mv.transform((View x) => x));
33 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698