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

Side by Side Diff: tests/language/src/DynamicTest.dart

Issue 9582027: Some use of the new @static-clean and /// annotations in shared tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « tests/language/src/DynamicFieldTest.dart ('k') | tests/language/src/Factory2Test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // @static-clean
6 7
7 class M1<K, V> implements Map<K, V> { 8 interface Iface<K,V> {
8 } 9 }
9 10
10 class M2<K> implements Map<K, Dynamic> { 11 class M1<K, V> implements Iface<K, V> {
11 } 12 }
12 13
13 class M3 implements Map<String, Dynamic> { 14 class M2<K> implements Iface<K, Dynamic> {
15 }
16
17 class M3 implements Iface<String, Dynamic> {
14 } 18 }
15 19
16 typedef Dynamic F1<T>(Dynamic x, T y); 20 typedef Dynamic F1<T>(Dynamic x, T y);
17 21
18 class HasFieldDynamic { 22 class HasFieldDynamic {
19 HasFieldDynamic() : Dynamic = "Dynamic" { } 23 HasFieldDynamic() : Dynamic = "Dynamic" { }
20 var Dynamic; // Field named Dynamic is allowed. 24 var Dynamic; // Field named Dynamic is allowed.
21 } 25 }
22 26
23 class HasMethodDynamic { 27 class HasMethodDynamic {
24 Dynamic() => "Dynamic"; // Method named Dynamic is allowed. 28 Dynamic() => "Dynamic"; // Method named Dynamic is allowed.
25 } 29 }
26 30
27 main() { 31 main() {
28 M1<Dynamic, Dynamic> m1 = new M1<Dynamic, Dynamic>(); 32 M1<Dynamic, Dynamic> m1 = new M1<Dynamic, Dynamic>();
29 Expect.isTrue(m1 is Map<Dynamic, num>); 33 Expect.isTrue(m1 is Iface<Dynamic, num>);
30 Expect.isTrue(m1 is Map<String, Dynamic>); 34 Expect.isTrue(m1 is Iface<String, Dynamic>);
31 Expect.isTrue(m1 is Map<String, num>); 35 Expect.isTrue(m1 is Iface<String, num>);
32 Expect.isTrue(m1 is Map<num, String>); 36 Expect.isTrue(m1 is Iface<num, String>);
33 37
34 M2<Dynamic> m2 = new M2<Dynamic>(); 38 M2<Dynamic> m2 = new M2<Dynamic>();
35 Expect.isTrue(m2 is Map<Dynamic, num>); 39 Expect.isTrue(m2 is Iface<Dynamic, num>);
36 Expect.isTrue(m2 is Map<String, Dynamic>); 40 Expect.isTrue(m2 is Iface<String, Dynamic>);
37 Expect.isTrue(m2 is Map<String, num>); 41 Expect.isTrue(m2 is Iface<String, num>);
38 Expect.isTrue(m2 is Map<num, String>); 42 Expect.isTrue(m2 is Iface<num, String>);
39 43
40 M3 m3 = new M3(); 44 M3 m3 = new M3();
41 Expect.isTrue(m3 is Map<Dynamic, num>); 45 Expect.isTrue(m3 is Iface<Dynamic, num>);
42 Expect.isTrue(m3 is Map<String, Dynamic>); 46 Expect.isTrue(m3 is Iface<String, Dynamic>);
43 Expect.isTrue(m3 is Map<String, num>); 47 Expect.isTrue(m3 is Iface<String, num>);
44 Expect.isTrue(m3 is !Map<num, String>); 48 Expect.isTrue(m3 is !Iface<num, String>);
45 49
46 F1<int> f1 = (String s, int i) => s[i]; 50 F1<int> f1 = (String s, int i) => s[i];
47 Expect.isTrue(f1 is F1<int>); 51 Expect.isTrue(f1 is F1<int>);
48 52
49 HasFieldDynamic has_field = new HasFieldDynamic(); 53 HasFieldDynamic has_field = new HasFieldDynamic();
50 Expect.equals("Dynamic", has_field.Dynamic); 54 Expect.equals("Dynamic", has_field.Dynamic);
51 55
52 HasMethodDynamic has_method = new HasMethodDynamic(); 56 HasMethodDynamic has_method = new HasMethodDynamic();
53 Expect.equals("Dynamic", has_method.Dynamic()); 57 Expect.equals("Dynamic", has_method.Dynamic());
54 58
55 { 59 {
56 int Dynamic = 0; // Local variable named Dynamic is allowed. 60 int Dynamic = 0; // Local variable named Dynamic is allowed.
57 Expect.equals(0, Dynamic); 61 Expect.equals(0, Dynamic);
58 } 62 }
59 } 63 }
OLDNEW
« no previous file with comments | « tests/language/src/DynamicFieldTest.dart ('k') | tests/language/src/Factory2Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698