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

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

Issue 218273002: Upgrading tests with unittest deprecations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 the basic StreamController and StreamController.singleSubscription. 5 // Test the basic StreamController and StreamController.singleSubscription.
6 library stream_join_test; 6 library stream_join_test;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'event_helper.dart'; 9 import 'event_helper.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 import "package:expect/expect.dart"; 11 import "package:expect/expect.dart";
12 12
13 main() { 13 main() {
14 test("join-empty", () { 14 test("join-empty", () {
15 StreamController c = new StreamController(); 15 StreamController c = new StreamController();
16 c.stream.join("X").then(expectAsync1( 16 c.stream.join("X").then(expectAsync(
17 (String s) => expect(s, equals("")) 17 (String s) => expect(s, equals(""))
18 )); 18 ));
19 c.close(); 19 c.close();
20 }); 20 });
21 21
22 test("join-single", () { 22 test("join-single", () {
23 StreamController c = new StreamController(); 23 StreamController c = new StreamController();
24 c.stream.join("X").then(expectAsync1( 24 c.stream.join("X").then(expectAsync(
25 (String s) => expect(s, equals("foo")) 25 (String s) => expect(s, equals("foo"))
26 )); 26 ));
27 c.add("foo"); 27 c.add("foo");
28 c.close(); 28 c.close();
29 }); 29 });
30 30
31 test("join-three", () { 31 test("join-three", () {
32 StreamController c = new StreamController(); 32 StreamController c = new StreamController();
33 c.stream.join("X").then(expectAsync1( 33 c.stream.join("X").then(expectAsync(
34 (String s) => expect(s, equals("fooXbarXbaz")) 34 (String s) => expect(s, equals("fooXbarXbaz"))
35 )); 35 ));
36 c.add("foo"); 36 c.add("foo");
37 c.add("bar"); 37 c.add("bar");
38 c.add("baz"); 38 c.add("baz");
39 c.close(); 39 c.close();
40 }); 40 });
41 41
42 test("join-three-non-string", () { 42 test("join-three-non-string", () {
43 StreamController c = new StreamController(); 43 StreamController c = new StreamController();
44 c.stream.join("X").then(expectAsync1( 44 c.stream.join("X").then(expectAsync(
45 (String s) => expect(s, equals("fooXbarXbaz")) 45 (String s) => expect(s, equals("fooXbarXbaz"))
46 )); 46 ));
47 c.add(new Foo("foo")); 47 c.add(new Foo("foo"));
48 c.add(new Foo("bar")); 48 c.add(new Foo("bar"));
49 c.add(new Foo("baz")); 49 c.add(new Foo("baz"));
50 c.close(); 50 c.close();
51 }); 51 });
52 52
53 test("join-error", () { 53 test("join-error", () {
54 StreamController c = new StreamController(); 54 StreamController c = new StreamController();
55 c.stream.join("X").catchError(expectAsync1( 55 c.stream.join("X").catchError(expectAsync(
56 (String s) => expect(s, equals("BAD!")) 56 (String s) => expect(s, equals("BAD!"))
57 )); 57 ));
58 c.add(new Foo("foo")); 58 c.add(new Foo("foo"));
59 c.add(new Foo("bar")); 59 c.add(new Foo("bar"));
60 c.add(new Bad()); 60 c.add(new Bad());
61 c.add(new Foo("baz")); 61 c.add(new Foo("baz"));
62 c.close(); 62 c.close();
63 }); 63 });
64 } 64 }
65 65
66 class Foo { 66 class Foo {
67 String value; 67 String value;
68 Foo(this.value); 68 Foo(this.value);
69 String toString() => value; 69 String toString() => value;
70 } 70 }
71 71
72 class Bad { 72 class Bad {
73 Bad(); 73 Bad();
74 String toString() => throw "BAD!"; 74 String toString() => throw "BAD!";
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698