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

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

Issue 12213009: Fix bad handling of done events in _ForwardingStream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added more chaining in the test. Created 7 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 | « sdk/lib/async/stream_pipe.dart ('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
(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
5 library stream_transform_test;
6
7 import 'dart:async';
8 import '../../../pkg/unittest/lib/unittest.dart';
9 import 'event_helper.dart';
10
11
12 main() {
13 // Regression tests for http://dartbug.com/8311
14
15 test("simpleDone", () {
16 StreamController c = new StreamController();
17 Stream out = c.stream.handleError((x){}).handleError((x){});
18 out.listen((v){}, onDone: expectAsync0(() {}));
19 // Should not throw.
20 c.close();
21 });
22
23 test("with events", () {
24 StreamController c = new StreamController();
25 Events expected = new Events.fromIterable([10, 12]);
26 Events input = new Events.fromIterable([1, 2, 3, 4, 5, 6, 7]);
27 Events actual = new Events.capture(
28 c.stream.map((x) => x * 2).where((x) => x > 5).skip(2).take(2));
29 actual.onDone(expectAsync0(() {
30 Expect.listEquals(expected.events, actual.events);
31 }));
32 input.replay(c);
33 });
34
35 test("paused events", () {
36 StreamController c = new StreamController();
37 Events expected = new Events.fromIterable([10, 12]);
38 Events input = new Events.fromIterable([1, 2, 3, 4, 5, 6, 7]);
39 Events actual = new Events.capture(
40 c.stream.map((x) => x * 2).where((x) => x > 5).skip(2).take(2));
41 actual.onDone(expectAsync0(() {
42 Expect.listEquals(expected.events, actual.events);
43 }));
44 actual.pause();
45 input.replay(c);
46 actual.resume();
47 });
48 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream_pipe.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698