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

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

Issue 11377102: Remove named function literals from library and tests (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/generic_syntax_test.dart ('k') | tests/language/list_test.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 // Dart test for generic types. 4 // Dart test for generic types.
5 5
6 class GenericsTest<T,V> implements Map<int, int> { 6 class GenericsTest<T,V> implements Map<int, int> {
7 static int myFunc(bool a, bool b) { 7 static int myFunc(bool a, bool b) {
8 Expect.equals(true, a); 8 Expect.equals(true, a);
9 Expect.equals(false, b); 9 Expect.equals(false, b);
10 return 42; 10 return 42;
11 } 11 }
12 12
13 static void testMain() { 13 static void testMain() {
14 int a = 1; 14 int a = 1;
15 int b = 2; 15 int b = 2;
16 int c = 3; 16 int c = 3;
17 int d = 4; 17 int d = 4;
18 Expect.equals(true, a<b); 18 Expect.equals(true, a<b);
19 Expect.equals(42, myFunc(a<b, c> d)); 19 Expect.equals(42, myFunc(a<b, c> d));
20 Map<int, int> e; 20 Map<int, int> e;
21 GenericsTest<int, GenericsTest<int, int>> f; 21 GenericsTest<int, GenericsTest<int, int>> f;
22 22
23 takesVoidMethod(void _(int a) {
24 Expect.equals(2, a);
25 });
26
27 takesGenericMapMethod(Map<int, int> _(int a) {
28 Expect.equals(2, a);
29 return null;
30 });
31
32 takesIntMethod(int _(int a) {
33 Expect.equals(2, a);
34 return 98;
35 });
36
37 e = new Map(); 23 e = new Map();
38 takesMapMethod(e); 24 takesMapMethod(e);
39 Expect.equals(2, e[0]); 25 Expect.equals(2, e[0]);
40 Map h = new Map<int, int>(); 26 Map h = new Map<int, int>();
41 } 27 }
42 28
43 static void takesVoidMethod(void f(int a)) {
44 f(2);
45 }
46
47 static void takesIntMethod(int f(int a)) {
48 Expect.equals(98, f(2));
49 }
50
51 static void takesGenericMapMethod(Map<int, int> f(int a)) {
52 f(2);
53 }
54
55 static void takesMapMethod(Map<int, int> m) { 29 static void takesMapMethod(Map<int, int> m) {
56 m[0] = 2; 30 m[0] = 2;
57 } 31 }
58 32
59 Map<int, int> returnMap() { 33 Map<int, int> returnMap() {
60 return null; 34 return null;
61 } 35 }
62 } 36 }
63 37
64 class LongGeneric<A, B, C> { 38 class LongGeneric<A, B, C> {
(...skipping 11 matching lines...) Expand all
76 LongGeneric< 50 LongGeneric<
77 C, 51 C,
78 List<E>, 52 List<E>,
79 Map<G, LongGeneric<I, J, List<A>>>>> id2; 53 Map<G, LongGeneric<I, J, List<A>>>>> id2;
80 } 54 }
81 } 55 }
82 56
83 main() { 57 main() {
84 GenericsTest.testMain(); 58 GenericsTest.testMain();
85 } 59 }
OLDNEW
« no previous file with comments | « tests/language/generic_syntax_test.dart ('k') | tests/language/list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698