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

Side by Side Diff: tests/lib/async/stream_empty_test.dart

Issue 1188613008: Fix timing issue in stream_empty_test, and make analyzer expect it to pass. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | tests/lib/lib.status » ('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) 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 // Test empty stream. 5 // Test empty stream.
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 import "dart:async"; 7 import "dart:async";
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 9
10 main() async { 10 main() {
11 asyncStart();
12 runTest().whenComplete(asyncEnd);
13 }
14
15 Future runTest() async {
11 unreachable([a,b]) { throw "UNREACHABLE"; } 16 unreachable([a,b]) { throw "UNREACHABLE"; }
12 int tick = 0; 17 int tick = 0;
13 ticker() { tick++; } 18 ticker() { tick++; }
14 19
15 asyncStart(); 20 asyncStart();
16 21
17 Stream<int> s = const Stream<int>.empty(); // Is const constructor. 22 Stream<int> s = const Stream<int>.empty(); // Is const constructor.
18 Expect.isFalse(s is Stream<String>); // Respects type parameter. 23 Expect.isFalse(s is Stream<String>); // Respects type parameter.
19 StreamSubscription<int> sub = 24 StreamSubscription<int> sub =
20 s.listen(unreachable, onError: unreachable, onDone: ticker); 25 s.listen(unreachable, onError: unreachable, onDone: ticker);
(...skipping 28 matching lines...) Expand all
49 Expect.equals(tick, 1); 54 Expect.equals(tick, 1);
50 sub3.resume(); 55 sub3.resume();
51 await flushMicrotasks(); 56 await flushMicrotasks();
52 // Now completed. 57 // Now completed.
53 Expect.equals(tick, 2); 58 Expect.equals(tick, 2);
54 59
55 asyncEnd(); 60 asyncEnd();
56 } 61 }
57 62
58 Future flushMicrotasks() => new Future.delayed(Duration.ZERO); 63 Future flushMicrotasks() => new Future.delayed(Duration.ZERO);
OLDNEW
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698