OLD | NEW |
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 basic StreamController and StreamController.singleSubscription. | 5 // Test the Stream.single method. |
6 library stream_single_test; | 6 library stream_single_test; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 import '../../../pkg/unittest/lib/unittest.dart'; | 10 import '../../../pkg/unittest/lib/unittest.dart'; |
11 import 'event_helper.dart'; | 11 import 'event_helper.dart'; |
12 | 12 |
13 main() { | 13 main() { |
14 test("single", () { | 14 test("single", () { |
15 StreamController c = new StreamController(); | 15 StreamController c = new StreamController(); |
(...skipping 26 matching lines...) Expand all Loading... |
42 }); | 42 }); |
43 | 43 |
44 test("single error 3", () { | 44 test("single error 3", () { |
45 StreamController c = new StreamController(); | 45 StreamController c = new StreamController(); |
46 Future f = c.single; | 46 Future f = c.single; |
47 f.catchError(expectAsync1((e) { Expect.equals("error", e.error); })); | 47 f.catchError(expectAsync1((e) { Expect.equals("error", e.error); })); |
48 Events errorEvents = new Events()..add(499)..error("error")..close(); | 48 Events errorEvents = new Events()..add(499)..error("error")..close(); |
49 errorEvents.replay(c); | 49 errorEvents.replay(c); |
50 }); | 50 }); |
51 } | 51 } |
OLD | NEW |