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

Side by Side Diff: tests/lib_strong/async/stream_join_test.dart

Issue 2802973005: Migrate async tests to strong (Closed)
Patch Set: Created 3 years, 8 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
(Empty)
1 // Copyright (c) 2013, 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 // Test the basic StreamController and StreamController.singleSubscription.
6 library stream_join_test;
7
8 import 'dart:async';
9 import 'event_helper.dart';
10 import 'package:unittest/unittest.dart';
11 import "package:expect/expect.dart";
12
13 main() {
14 test("join-empty", () {
15 StreamController c = new StreamController();
16 c.stream.join("X").then(expectAsync(
17 (String s) => expect(s, equals(""))
18 ));
19 c.close();
20 });
21
22 test("join-single", () {
23 StreamController c = new StreamController();
24 c.stream.join("X").then(expectAsync(
25 (String s) => expect(s, equals("foo"))
26 ));
27 c.add("foo");
28 c.close();
29 });
30
31 test("join-three", () {
32 StreamController c = new StreamController();
33 c.stream.join("X").then(expectAsync(
34 (String s) => expect(s, equals("fooXbarXbaz"))
35 ));
36 c.add("foo");
37 c.add("bar");
38 c.add("baz");
39 c.close();
40 });
41
42 test("join-three-non-string", () {
43 StreamController c = new StreamController();
44 c.stream.join("X").then(expectAsync(
45 (String s) => expect(s, equals("fooXbarXbaz"))
46 ));
47 c.add(new Foo("foo"));
48 c.add(new Foo("bar"));
49 c.add(new Foo("baz"));
50 c.close();
51 });
52
53 test("join-error", () {
54 StreamController c = new StreamController();
55 c.stream.join("X").catchError(expectAsync(
56 (String s) => expect(s, equals("BAD!"))
57 ));
58 c.add(new Foo("foo"));
59 c.add(new Foo("bar"));
60 c.add(new Bad());
61 c.add(new Foo("baz"));
62 c.close();
63 });
64 }
65
66 class Foo {
67 String value;
68 Foo(this.value);
69 String toString() => value;
70 }
71
72 class Bad {
73 Bad();
74 String toString() => throw "BAD!";
75 }
OLDNEW
« no previous file with comments | « tests/lib_strong/async/stream_iterator_test.dart ('k') | tests/lib_strong/async/stream_last_where_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698