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

Side by Side Diff: tests/language/dynamic_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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 // Dart test program testing the use of 'dynamic' in generic types. 5 // Dart test program testing the use of 'dynamic' in generic types.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 8
9 abstract class Iface<K,V> { 9 abstract class Iface<K, V> {}
10 }
11 10
12 class M1<K, V> implements Iface<K, V> { 11 class M1<K, V> implements Iface<K, V> {}
13 }
14 12
15 class M2<K> implements Iface<K, dynamic> { 13 class M2<K> implements Iface<K, dynamic> {}
16 }
17 14
18 class M3 implements Iface<String, dynamic> { 15 class M3 implements Iface<String, dynamic> {}
19 }
20 16
21 typedef dynamic F1<T>(dynamic x, T y); 17 typedef dynamic F1<T>(dynamic x, T y);
22 18
23 class HasFieldDynamic { 19 class HasFieldDynamic {
24 HasFieldDynamic() : dynamic = "dynamic" { } 20 HasFieldDynamic() : dynamic = "dynamic" {}
25 var dynamic; // Field named dynamic is allowed. 21 var dynamic; // Field named dynamic is allowed.
26 } 22 }
27 23
28 class HasMethodDynamic { 24 class HasMethodDynamic {
29 dynamic() => "dynamic"; // Method named dynamic is allowed. 25 dynamic() => "dynamic"; // Method named dynamic is allowed.
30 } 26 }
31 27
32 main() { 28 main() {
33 Expect.isTrue(dynamic is Type); 29 Expect.isTrue(dynamic is Type);
34 Expect.equals(dynamic, dynamic); 30 Expect.equals(dynamic, dynamic);
35 31
36 M1<dynamic, dynamic> m1 = new M1<dynamic, dynamic>(); 32 M1<dynamic, dynamic> m1 = new M1<dynamic, dynamic>();
37 Expect.isTrue(m1 is Iface<dynamic, num>); 33 Expect.isTrue(m1 is Iface<dynamic, num>);
38 Expect.isTrue(m1 is Iface<String, dynamic>); 34 Expect.isTrue(m1 is Iface<String, dynamic>);
39 Expect.isTrue(m1 is Iface<String, num>); 35 Expect.isTrue(m1 is Iface<String, num>);
40 Expect.isTrue(m1 is Iface<num, String>); 36 Expect.isTrue(m1 is Iface<num, String>);
41 37
42 M2<dynamic> m2 = new M2<dynamic>(); 38 M2<dynamic> m2 = new M2<dynamic>();
43 Expect.isTrue(m2 is Iface<dynamic, num>); 39 Expect.isTrue(m2 is Iface<dynamic, num>);
44 Expect.isTrue(m2 is Iface<String, dynamic>); 40 Expect.isTrue(m2 is Iface<String, dynamic>);
45 Expect.isTrue(m2 is Iface<String, num>); 41 Expect.isTrue(m2 is Iface<String, num>);
46 Expect.isTrue(m2 is Iface<num, String>); 42 Expect.isTrue(m2 is Iface<num, String>);
47 43
48 M3 m3 = new M3(); 44 M3 m3 = new M3();
49 Expect.isTrue(m3 is Iface<dynamic, num>); 45 Expect.isTrue(m3 is Iface<dynamic, num>);
50 Expect.isTrue(m3 is Iface<String, dynamic>); 46 Expect.isTrue(m3 is Iface<String, dynamic>);
51 Expect.isTrue(m3 is Iface<String, num>); 47 Expect.isTrue(m3 is Iface<String, num>);
52 Expect.isTrue(m3 is !Iface<num, String>); 48 Expect.isTrue(m3 is! Iface<num, String>);
53 49
54 F1<int> f1 = (String s, int i) => s[i]; 50 F1<int> f1 = (String s, int i) => s[i];
55 Expect.isTrue(f1 is F1<int>); 51 Expect.isTrue(f1 is F1<int>);
56 52
57 HasFieldDynamic has_field = new HasFieldDynamic(); 53 HasFieldDynamic has_field = new HasFieldDynamic();
58 Expect.equals("dynamic", has_field.dynamic); 54 Expect.equals("dynamic", has_field.dynamic);
59 55
60 HasMethodDynamic has_method = new HasMethodDynamic(); 56 HasMethodDynamic has_method = new HasMethodDynamic();
61 Expect.equals("dynamic", has_method.dynamic()); 57 Expect.equals("dynamic", has_method.dynamic());
62 58
63 { 59 {
64 int dynamic = 0; // Local variable named dynamic is allowed. 60 int dynamic = 0; // Local variable named dynamic is allowed.
65 Expect.equals(0, dynamic); 61 Expect.equals(0, dynamic);
66 } 62 }
67 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698