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

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: More tests 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.catchError((x){}).catchError((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([6, 8, 10]);
26 Events input = new Events.fromIterable([1, 2, 3, 4, 5]);
27 Events actual = new Events.capture(
28 c.stream.map((x) => x * 2).where((x) => x > 5));
29 actual.onDone(() {
floitsch 2013/02/05 15:09:51 expectAsync0
Lasse Reichstein Nielsen 2013/02/07 10:16:58 Done.
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([6, 8, 10]);
38 Events input = new Events.fromIterable([1, 2, 3, 4, 5]);
39 Events actual = new Events.capture(
40 c.stream.map((x) => x * 2).where((x) => x > 5));
41 actual.onDone(expectAsync0(() {
42 Expect.listEquals(expected.events, actual.events);
43 }));
44 actual.pause();
45 input.replay(c);
46 actual.resume();
47 });
48 }
floitsch 2013/02/05 15:09:51 more tests! :) some other transformations would be
Lasse Reichstein Nielsen 2013/02/07 10:16:58 That won't give any more coverage for this bug. It
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