Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 library error_group_test; | 5 library error_group_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 test('should pass through a value from the future', () { | 56 test('should pass through a value from the future', () { |
| 57 expect(future, completion(equals('value'))); | 57 expect(future, completion(equals('value'))); |
| 58 expect(errorGroup.done, completes); | 58 expect(errorGroup.done, completes); |
| 59 completer.complete('value'); | 59 completer.complete('value'); |
| 60 }); | 60 }); |
| 61 | 61 |
| 62 test("shouldn't allow additional futures or streams once .done has " | 62 test("shouldn't allow additional futures or streams once .done has " |
| 63 "been called", () { | 63 "been called", () { |
| 64 completer.complete('value'); | 64 completer.complete('value'); |
| 65 | 65 |
| 66 expect(() => errorGroup.registerFuture(new Future.value()), | 66 completer.future.then(expectAsync1((_) { |
|
nweiz
2013/05/07 00:18:11
As in the other CL, convert these to "expect(compl
floitsch
2013/06/13 15:52:35
done in https://codereview.chromium.org/16950010
| |
| 67 throwsStateError); | 67 expect(() => errorGroup.registerFuture(new Future.value()), |
| 68 expect(() => errorGroup.registerStream(new StreamController().stream), | 68 throwsStateError); |
| 69 throwsStateError); | 69 expect(() => errorGroup.registerStream(new StreamController().stream), |
| 70 throwsStateError); | |
| 71 })); | |
| 70 }); | 72 }); |
| 71 | 73 |
| 72 test('should pass through an exception from the future if it has a ' | 74 test('should pass through an exception from the future if it has a ' |
| 73 'listener', () { | 75 'listener', () { |
| 74 expect(future, throwsFormatException); | 76 expect(future, throwsFormatException); |
| 75 // errorGroup shouldn't top-level the exception | 77 // errorGroup shouldn't top-level the exception |
| 76 completer.completeError(new FormatException()); | 78 completer.completeError(new FormatException()); |
| 77 }); | 79 }); |
| 78 | 80 |
| 79 test('should notify the error group of an exception from the future even ' | 81 test('should notify the error group of an exception from the future even ' |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 expect(stream.toList(), completion(equals(['value1', 'value2']))); | 422 expect(stream.toList(), completion(equals(['value1', 'value2']))); |
| 421 controller..add('value1')..add('value2')..close(); | 423 controller..add('value1')..add('value2')..close(); |
| 422 | 424 |
| 423 expect(stream.toList().then((_) { | 425 expect(stream.toList().then((_) { |
| 424 // shouldn't cause a top-level exception | 426 // shouldn't cause a top-level exception |
| 425 completer.completeError(new FormatException()); | 427 completer.completeError(new FormatException()); |
| 426 }), completes); | 428 }), completes); |
| 427 }); | 429 }); |
| 428 }); | 430 }); |
| 429 } | 431 } |
| OLD | NEW |