Index: sdk/lib/_internal/pub/test/error_group_test.dart |
diff --git a/sdk/lib/_internal/pub/test/error_group_test.dart b/sdk/lib/_internal/pub/test/error_group_test.dart |
index d22f12cf63ee7421178f2a6893610bdea7d8db79..ff2f699dbacd75574e7b677a65c1bd600896746b 100644 |
--- a/sdk/lib/_internal/pub/test/error_group_test.dart |
+++ b/sdk/lib/_internal/pub/test/error_group_test.dart |
@@ -210,16 +210,8 @@ main() { |
}); |
test('should pass through values from the stream', () { |
- StreamIterator iter = new StreamIterator(stream); |
- iter.moveNext().then((hasNext) { |
- expect(hasNext, isTrue); |
- expect(iter.current, equals(1)); |
- iter.moveNext().then((hasNext) { |
- expect(hasNext, isTrue); |
- expect(iter.current, equals(2)); |
- expect(iter.moveNext(), completion(isFalse)); |
- }); |
- }); |
+ expect(stream.elementAt(0), completion(equals(1))); |
+ expect(stream.elementAt(1), completion(equals(2))); |
expect(errorGroup.done, completes); |
controller..add(1)..add(2)..close(); |
@@ -240,14 +232,15 @@ main() { |
}); |
test('should pass a signaled exception to the stream if it has a listener ' |
- 'and should unsubscribe that stream', () { |
- // errorGroup shouldn't top-level the exception |
+ 'and should unsubscribe that stream', () { |
expect(stream.first, throwsFormatException); |
+ // errorGroup shouldn't top-level the exception |
errorGroup.signalError(new FormatException()); |
- expect(new Future(() { |
+ expect(stream.first.catchError((_) { |
controller.add('value'); |
- }), completes); |
+ return stream.isEmpty; |
+ }), completion(isTrue)); |
}); |
test('should notify the error group of a signaled exception even if the ' |
@@ -352,12 +345,10 @@ main() { |
test("shouldn't throw a top-level exception if a stream receives an error " |
"after the other listened stream completes", () { |
- var signal = new Completer(); |
- expect(stream1.toList().whenComplete(signal.complete), |
- completion(equals(['value1', 'value2']))); |
+ expect(stream1.toList(), completion(equals(['value1', 'value2']))); |
controller1..add('value1')..add('value2')..close(); |
- expect(signal.future.then((_) { |
+ expect(stream1.toList().then((_) { |
// shouldn't cause a top-level exception |
controller2.addError(new FormatException()); |
}), completes); |
@@ -365,12 +356,10 @@ main() { |
test("shouldn't throw a top-level exception if an error is signaled after " |
"one listened stream completes", () { |
- var signal = new Completer(); |
- expect(stream1.toList().whenComplete(signal.complete), |
- completion(equals(['value1', 'value2']))); |
+ expect(stream1.toList(), completion(equals(['value1', 'value2']))); |
controller1..add('value1')..add('value2')..close(); |
- expect(signal.future.then((_) { |
+ expect(stream1.toList().then((_) { |
// shouldn't cause a top-level exception |
errorGroup.signalError(new FormatException()); |
}), completes); |
@@ -430,12 +419,10 @@ main() { |
test("shouldn't throw a top-level exception if the future receives an " |
"error after the listened stream completes", () { |
- var signal = new Completer(); |
- expect(stream.toList().whenComplete(signal.complete), |
- completion(equals(['value1', 'value2']))); |
+ expect(stream.toList(), completion(equals(['value1', 'value2']))); |
controller..add('value1')..add('value2')..close(); |
- expect(signal.future.then((_) { |
+ expect(stream.toList().then((_) { |
// shouldn't cause a top-level exception |
completer.completeError(new FormatException()); |
}), completes); |