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

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

Issue 910243002: Re-apply "Fix warning in sync_generator1_test.dart" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/language_analyzer2.status ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Simple test program for sync* generator functions. 5 // Simple test program for sync* generator functions.
6 6
7 // VMOptions=--optimization_counter_threshold=10 7 // VMOptions=--optimization_counter_threshold=10
8 8
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 einsZwei() sync* { 37 einsZwei() sync* {
38 yield 1; 38 yield 1;
39 yield* [2, 3]; 39 yield* [2, 3];
40 yield* []; 40 yield* [];
41 yield 5; 41 yield 5;
42 yield [6]; 42 yield [6];
43 } 43 }
44 44
45 dreiVier() sync* { 45 dreiVier() sync* {
46 yield* 3; // Throws type error: yielded object is not an iterable. 46 // Throws type error: yielded object is not an iterable.
47 yield* 3; /// 01: static type warning
47 } 48 }
48 49
49 main() { 50 main() {
50 for (int i = 0; i < 10; i++) { 51 for (int i = 0; i < 10; i++) {
51 var sums = sum10(); 52 var sums = sum10();
52 print(sums); 53 print(sums);
53 Expect.isTrue(sums is Iterable); 54 Expect.isTrue(sums is Iterable);
54 Expect.equals(10, sums.length); 55 Expect.equals(10, sums.length);
55 Expect.equals(1, sums.first); 56 Expect.equals(1, sums.first);
56 Expect.equals(55, sums.last); 57 Expect.equals(55, sums.last);
(...skipping 15 matching lines...) Expand all
72 Expect.isTrue(i.moveNext()); 73 Expect.isTrue(i.moveNext());
73 Expect.equals(e, i.current); 74 Expect.equals(e, i.current);
74 }); 75 });
75 76
76 print(sync); 77 print(sync);
77 Expect.equals("sync", sync.single); 78 Expect.equals("sync", sync.single);
78 79
79 print(einsZwei()); 80 print(einsZwei());
80 Expect.equals("(1, 2, 3, 5, [6])", einsZwei().toString()); 81 Expect.equals("(1, 2, 3, 5, [6])", einsZwei().toString());
81 82
82 Expect.throws(() => dreiVier().toString()); 83 Expect.throws(() => dreiVier().toString()); /// 01: continued
83 } 84 }
84 } 85 }
OLDNEW
« no previous file with comments | « tests/language/language_analyzer2.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698