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

Side by Side Diff: tests/language_strong/function_subtype_cast3_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Dart test program for constructors and initializers. 4 // Dart test program for constructors and initializers.
5 5
6 // Check function subtyping casts. 6 // Check function subtyping casts.
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 typedef void Foo<T>(T t); 10 typedef void Foo<T>(T t);
11 typedef void Bar(int i); 11 typedef void Bar(int i);
12 12
13 class Class<T> { 13 class Class<T> {
14 test(bool expectedResult, var o, String typeName) { 14 test(bool expectedResult, var o, String typeName) {
15 void local() { 15 void local() {
16 if (expectedResult) { 16 if (expectedResult) {
17 Expect.isNotNull(o as Foo<T>, "bar as Foo<$typeName>"); 17 Expect.isNotNull(o as Foo<T>, "bar as Foo<$typeName>");
18 } else { 18 } else {
19 Expect.throws(() => o as Foo<T>, (e) => true, "bar as Foo<$typeName>"); 19 Expect.throws(() => o as Foo<T>, (e) => true, "bar as Foo<$typeName>");
20 } 20 }
21 Expect.isNotNull(o as Bar, "bar as Bar"); 21 Expect.isNotNull(o as Bar, "bar as Bar");
22 } 22 }
23
23 local(); 24 local();
24 } 25 }
25 } 26 }
26 27
27 void bar(int i) {} 28 void bar(int i) {}
28 29
29 void main() { 30 void main() {
30 new Class().test(true, bar, "dynamic"); 31 new Class().test(true, bar, "dynamic");
31 new Class<int>().test(true, bar, "int"); 32 new Class<int>().test(true, bar, "int");
32 new Class<bool>().test(false, bar, "bool"); 33 new Class<bool>().test(false, bar, "bool");
33 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698