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

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

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

Powered by Google App Engine
This is Rietveld 408576698