| 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 basic StreamController and StreamController.singleSubscription. |
| 6 library stream_controller_async_test; | 6 library stream_controller_async_test; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 test("elementAt", () { | 239 test("elementAt", () { |
| 240 StreamController c = new StreamController(); | 240 StreamController c = new StreamController(); |
| 241 Future f = c.stream.elementAt(2); | 241 Future f = c.stream.elementAt(2); |
| 242 f.then(expectAsync1((v) { Expect.equals(13, v);})); | 242 f.then(expectAsync1((v) { Expect.equals(13, v);})); |
| 243 sentEvents.replay(c); | 243 sentEvents.replay(c); |
| 244 }); | 244 }); |
| 245 | 245 |
| 246 test("elementAt 2", () { | 246 test("elementAt 2", () { |
| 247 StreamController c = new StreamController(); | 247 StreamController c = new StreamController(); |
| 248 Future f = c.stream.elementAt(20); | 248 Future f = c.stream.elementAt(20); |
| 249 f.catchError(expectAsync1((error) { Expect.isTrue(error is StateError); })); | 249 f.catchError(expectAsync1((error) { Expect.isTrue(error is RangeError); })); |
| 250 sentEvents.replay(c); | 250 sentEvents.replay(c); |
| 251 }); | 251 }); |
| 252 | 252 |
| 253 test("drain", () { | 253 test("drain", () { |
| 254 StreamController c = new StreamController(); | 254 StreamController c = new StreamController(); |
| 255 Future f = c.stream.drain(); | 255 Future f = c.stream.drain(); |
| 256 f.then(expectAsync1((v) { Expect.equals(null, v);})); | 256 f.then(expectAsync1((v) { Expect.equals(null, v);})); |
| 257 sentEvents.replay(c); | 257 sentEvents.replay(c); |
| 258 }); | 258 }); |
| 259 | 259 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 testRethrow(); | 683 testRethrow(); |
| 684 testBroadcastController(); | 684 testBroadcastController(); |
| 685 testAsBroadcast(); | 685 testAsBroadcast(); |
| 686 testSink(sync: true, broadcast: false, asBroadcast: false); | 686 testSink(sync: true, broadcast: false, asBroadcast: false); |
| 687 testSink(sync: true, broadcast: false, asBroadcast: true); | 687 testSink(sync: true, broadcast: false, asBroadcast: true); |
| 688 testSink(sync: true, broadcast: true, asBroadcast: false); | 688 testSink(sync: true, broadcast: true, asBroadcast: false); |
| 689 testSink(sync: false, broadcast: false, asBroadcast: false); | 689 testSink(sync: false, broadcast: false, asBroadcast: false); |
| 690 testSink(sync: false, broadcast: false, asBroadcast: true); | 690 testSink(sync: false, broadcast: false, asBroadcast: true); |
| 691 testSink(sync: false, broadcast: true, asBroadcast: false); | 691 testSink(sync: false, broadcast: true, asBroadcast: false); |
| 692 } | 692 } |
| OLD | NEW |