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

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

Issue 2770063002: Revert "Format all multitests" (Closed)
Patch Set: Created 3 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
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
11 sum10() sync* { 11 sum10() sync* {
12 var s = 0; 12 var s = 0;
13 for (var k = 1; k <= 10; k++) { 13 for (var k = 1; k <= 10; k++) {
14 s += k; 14 s += k;
15 yield s; 15 yield s;
16 } 16 }
17 } 17 }
18 18
19 class Range { 19 class Range {
20 int start, end; 20 int start, end;
21 Range(this.start, this.end); 21 Range(this.start, this.end);
22 elements() sync* { 22 elements() sync* {
23 var e = start; 23 var e = start;
24 while (e <= end) yield e++; 24 while (e <= end) yield e++;
25 } 25 }
26 26
27 get yield sync* { 27 get yield sync* { // yield is a legal member name here.
28 // yield is a legal member name here.
29 var e = start; 28 var e = start;
30 while (e <= end) yield e++; 29 while (e <= end) yield e++;
31 } 30 }
32 } 31 }
33 32
34 get sync sync* { 33 get sync sync* { // sync is a legal identifier.
35 // sync is a legal identifier.
36 yield "sync"; 34 yield "sync";
37 } 35 }
38 36
39 einsZwei() sync* { 37 einsZwei() sync* {
40 yield 1; 38 yield 1;
41 yield* [2, 3]; 39 yield* [2, 3];
42 yield* []; 40 yield* [];
43 yield 5; 41 yield 5;
44 yield [6]; 42 yield [6];
45 } 43 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 76
79 print(sync); 77 print(sync);
80 Expect.equals("sync", sync.single); 78 Expect.equals("sync", sync.single);
81 79
82 print(einsZwei()); 80 print(einsZwei());
83 Expect.equals("(1, 2, 3, 5, [6])", einsZwei().toString()); 81 Expect.equals("(1, 2, 3, 5, [6])", einsZwei().toString());
84 82
85 Expect.throws(() => dreiVier().toString()); //# 01: continued 83 Expect.throws(() => dreiVier().toString()); //# 01: continued
86 } 84 }
87 } 85 }
OLDNEW
« no previous file with comments | « tests/language_strong/symbol_literal_test.dart ('k') | tests/language_strong/sync_generator2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698