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

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

Issue 2656503004: Revert "Remove package:unittest from some tests" (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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 Stream.single method. 5 // Test the Stream.single method.
6 library stream_single_test; 6 library stream_single_test;
7 7
8 import "package:expect/expect.dart";
8 import 'dart:async'; 9 import 'dart:async';
9 import 'package:test/test.dart'; 10 import 'package:unittest/unittest.dart';
10 import 'event_helper.dart'; 11 import 'event_helper.dart';
11 12
12 main() { 13 main() {
13 test("single", () { 14 test("single", () {
14 StreamController c = new StreamController(sync: true); 15 StreamController c = new StreamController(sync: true);
15 Future f = c.stream.single; 16 Future f = c.stream.single;
16 f.then(expectAsync((v) { expect(42, equals(v));})); 17 f.then(expectAsync((v) { Expect.equals(42, v);}));
17 new Events.fromIterable([42]).replay(c); 18 new Events.fromIterable([42]).replay(c);
18 }); 19 });
19 20
20 test("single empty", () { 21 test("single empty", () {
21 StreamController c = new StreamController(sync: true); 22 StreamController c = new StreamController(sync: true);
22 Future f = c.stream.single; 23 Future f = c.stream.single;
23 f.catchError(expectAsync((error) { expect(error is StateError, isTrue); })); 24 f.catchError(expectAsync((error) { Expect.isTrue(error is StateError); }));
24 new Events.fromIterable([]).replay(c); 25 new Events.fromIterable([]).replay(c);
25 }); 26 });
26 27
27 test("single error", () { 28 test("single error", () {
28 StreamController c = new StreamController(sync: true); 29 StreamController c = new StreamController(sync: true);
29 Future f = c.stream.single; 30 Future f = c.stream.single;
30 f.catchError(expectAsync((error) { expect("error", equals(error)); })); 31 f.catchError(expectAsync((error) { Expect.equals("error", error); }));
31 Events errorEvents = new Events()..error("error")..close(); 32 Events errorEvents = new Events()..error("error")..close();
32 errorEvents.replay(c); 33 errorEvents.replay(c);
33 }); 34 });
34 35
35 test("single error 2", () { 36 test("single error 2", () {
36 StreamController c = new StreamController(sync: true); 37 StreamController c = new StreamController(sync: true);
37 Future f = c.stream.single; 38 Future f = c.stream.single;
38 f.catchError(expectAsync((error) { expect("error", equals(error)); })); 39 f.catchError(expectAsync((error) { Expect.equals("error", error); }));
39 Events errorEvents = new Events()..error("error")..error("error2")..close(); 40 Events errorEvents = new Events()..error("error")..error("error2")..close();
40 errorEvents.replay(c); 41 errorEvents.replay(c);
41 }); 42 });
42 43
43 test("single error 3", () { 44 test("single error 3", () {
44 StreamController c = new StreamController(sync: true); 45 StreamController c = new StreamController(sync: true);
45 Future f = c.stream.single; 46 Future f = c.stream.single;
46 f.catchError(expectAsync((error) { expect("error", equals(error)); })); 47 f.catchError(expectAsync((error) { Expect.equals("error", error); }));
47 Events errorEvents = new Events()..add(499)..error("error")..close(); 48 Events errorEvents = new Events()..add(499)..error("error")..close();
48 errorEvents.replay(c); 49 errorEvents.replay(c);
49 }); 50 });
50 } 51 }
OLDNEW
« no previous file with comments | « tests/lib/async/stream_periodic_test.dart ('k') | tests/lib/async/stream_single_to_multi_subscriber_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698