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

Side by Side Diff: tests/language_strong/generics_test.dart

Issue 3001803002: Migrate block 114 (and some of 113). (Closed)
Patch Set: Tweak app_jit status. Created 3 years, 3 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
(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 // Dart test for generic types.
5
6 import "package:expect/expect.dart";
7
8 class GenericsTest<T, V> implements Map<int, int> {
9 static int myFunc(bool a, bool b) {
10 Expect.equals(true, a);
11 Expect.equals(false, b);
12 return 42;
13 }
14
15 static void testMain() {
16 int a = 1;
17 int b = 2;
18 int c = 3;
19 int d = 4;
20 Expect.equals(true, a < b);
21 Expect.equals(42, myFunc(a < b, c > d));
22 Map<int, int> e;
23 GenericsTest<int, GenericsTest<int, int>> f;
24
25 e = new Map();
26 takesMapMethod(e);
27 Expect.equals(2, e[0]);
28 Map h = new Map<int, int>();
29 }
30
31 static void takesMapMethod(Map<int, int> m) {
32 m[0] = 2;
33 }
34
35 Map<int, int> returnMap() {
36 return null;
37 }
38 }
39
40 class LongGeneric<A, B, C> {}
41
42 class LongerGeneric<A, B, C, D, E, F, G, H, I, J> {
43 void func() {
44 LongGeneric<String, A, LongGeneric<C, List<E>, Map<G, Map<I, J>>>> id;
45
46 LongGeneric<num, Map<int, int>,
47 LongGeneric<C, List<E>, Map<G, LongGeneric<I, J, List<A>>>>> id2;
48 }
49 }
50
51 main() {
52 GenericsTest.testMain();
53 }
OLDNEW
« no previous file with comments | « tests/language_strong/generics3_test.dart ('k') | tests/language_strong/get_set_syntax_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698