| 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.broadcast. | 5 // Test the basic StreamController and StreamController.broadcast. |
| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 c.close(); | 373 c.close(); |
| 374 }); | 374 }); |
| 375 } | 375 } |
| 376 | 376 |
| 377 testStreamError(name, streamErrorTransform) { | 377 testStreamError(name, streamErrorTransform) { |
| 378 test("rethrow-$name-error", () { | 378 test("rethrow-$name-error", () { |
| 379 StreamController c = new StreamController(); | 379 StreamController c = new StreamController(); |
| 380 Stream s = streamErrorTransform(c.stream, (e) { throw error; }); | 380 Stream s = streamErrorTransform(c.stream, (e) { throw error; }); |
| 381 s.listen((_) { Expect.fail("unexpected value"); }, onError: expectAsync( | 381 s.listen((_) { Expect.fail("unexpected value"); }, onError: expectAsync( |
| 382 (e) { Expect.identical(error, e); })); | 382 (e) { Expect.identical(error, e); })); |
| 383 c.addError(null); | 383 c.addError("SOME ERROR"); |
| 384 c.close(); | 384 c.close(); |
| 385 }); | 385 }); |
| 386 } | 386 } |
| 387 | 387 |
| 388 testFuture(name, streamValueTransform) { | 388 testFuture(name, streamValueTransform) { |
| 389 test("rethrow-$name-value", () { | 389 test("rethrow-$name-value", () { |
| 390 StreamController c = new StreamController(); | 390 StreamController c = new StreamController(); |
| 391 Future f = streamValueTransform(c.stream, (v) { throw error; }); | 391 Future f = streamValueTransform(c.stream, (v) { throw error; }); |
| 392 f.then((v) { Expect.fail("unreachable"); }, | 392 f.then((v) { Expect.fail("unreachable"); }, |
| 393 onError: expectAsync((e) { Expect.identical(error, e); })); | 393 onError: expectAsync((e) { Expect.identical(error, e); })); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 testRethrow(); | 763 testRethrow(); |
| 764 testBroadcastController(); | 764 testBroadcastController(); |
| 765 testAsBroadcast(); | 765 testAsBroadcast(); |
| 766 testSink(sync: true, broadcast: false, asBroadcast: false); | 766 testSink(sync: true, broadcast: false, asBroadcast: false); |
| 767 testSink(sync: true, broadcast: false, asBroadcast: true); | 767 testSink(sync: true, broadcast: false, asBroadcast: true); |
| 768 testSink(sync: true, broadcast: true, asBroadcast: false); | 768 testSink(sync: true, broadcast: true, asBroadcast: false); |
| 769 testSink(sync: false, broadcast: false, asBroadcast: false); | 769 testSink(sync: false, broadcast: false, asBroadcast: false); |
| 770 testSink(sync: false, broadcast: false, asBroadcast: true); | 770 testSink(sync: false, broadcast: false, asBroadcast: true); |
| 771 testSink(sync: false, broadcast: true, asBroadcast: false); | 771 testSink(sync: false, broadcast: true, asBroadcast: false); |
| 772 } | 772 } |
| OLD | NEW |