Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1736)

Unified Diff: sdk/lib/_internal/pub_generated/test/error_group_test.dart

Issue 887223007: Revert "Use native async/await support in pub." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub_generated/test/error_group_test.dart
diff --git a/sdk/lib/_internal/pub/test/error_group_test.dart b/sdk/lib/_internal/pub_generated/test/error_group_test.dart
similarity index 66%
copy from sdk/lib/_internal/pub/test/error_group_test.dart
copy to sdk/lib/_internal/pub_generated/test/error_group_test.dart
index 331a1ffd92bebf907458735045105f4fc28fc3a4..3589b3eb5495f1a769f79b1966057a15656a66db 100644
--- a/sdk/lib/_internal/pub/test/error_group_test.dart
+++ b/sdk/lib/_internal/pub_generated/test/error_group_test.dart
@@ -31,15 +31,18 @@ main() {
errorGroup.signalError(new FormatException());
});
- test("shouldn't allow additional futures or streams once an error has been "
- "signaled", () {
+ test(
+ "shouldn't allow additional futures or streams once an error has been "
+ "signaled",
+ () {
expect(errorGroup.done, throwsFormatException);
errorGroup.signalError(new FormatException());
- expect(() => errorGroup.registerFuture(new Future.value()),
+ expect(
+ () => errorGroup.registerFuture(new Future.value()),
throwsStateError);
- expect(() => errorGroup.registerStream(
- new StreamController(sync: true).stream),
+ expect(
+ () => errorGroup.registerStream(new StreamController(sync: true).stream),
throwsStateError);
});
});
@@ -60,68 +63,81 @@ main() {
completer.complete('value');
});
- test("shouldn't allow additional futures or streams once .done has "
- "been called", () {
+ test(
+ "shouldn't allow additional futures or streams once .done has " "been called",
+ () {
completer.complete('value');
- expect(completer.future
- .then((_) => errorGroup.registerFuture(new Future.value())),
- throwsStateError);
- expect(completer.future
- .then((_) => errorGroup.registerStream(
- new StreamController(sync: true).stream)),
- throwsStateError);
+ expect(
+ completer.future.then((_) => errorGroup.registerFuture(new Future.value())),
+ throwsStateError);
+ expect(
+ completer.future.then(
+ (_) => errorGroup.registerStream(new StreamController(sync: true).stream)),
+ throwsStateError);
});
- test('should pass through an exception from the future if it has a '
- 'listener', () {
+ test(
+ 'should pass through an exception from the future if it has a ' 'listener',
+ () {
expect(future, throwsFormatException);
// errorGroup shouldn't top-level the exception
completer.completeError(new FormatException());
});
- test('should notify the error group of an exception from the future even '
- 'if it has a listener', () {
+ test(
+ 'should notify the error group of an exception from the future even '
+ 'if it has a listener',
+ () {
expect(future, throwsFormatException);
expect(errorGroup.done, throwsFormatException);
completer.completeError(new FormatException());
});
- test('should pass a signaled exception to the future if it has a listener '
- 'and should ignore a subsequent value from that future', () {
+ test(
+ 'should pass a signaled exception to the future if it has a listener '
+ 'and should ignore a subsequent value from that future',
+ () {
expect(future, throwsFormatException);
// errorGroup shouldn't top-level the exception
errorGroup.signalError(new FormatException());
completer.complete('value');
});
- test('should pass a signaled exception to the future if it has a listener '
- 'and should ignore a subsequent exception from that future', () {
+ test(
+ 'should pass a signaled exception to the future if it has a listener '
+ 'and should ignore a subsequent exception from that future',
+ () {
expect(future, throwsFormatException);
// errorGroup shouldn't top-level the exception
errorGroup.signalError(new FormatException());
completer.completeError(new ArgumentError());
});
- test('should notify the error group of a signaled exception even if the '
- 'future has a listener', () {
+ test(
+ 'should notify the error group of a signaled exception even if the '
+ 'future has a listener',
+ () {
expect(future, throwsFormatException);
expect(errorGroup.done, throwsFormatException);
errorGroup.signalError(new FormatException());
});
- test("should complete .done if the future receives a value even if the "
- "future doesn't have a listener", () {
+ test(
+ "should complete .done if the future receives a value even if the "
+ "future doesn't have a listener",
+ () {
expect(errorGroup.done, completes);
completer.complete('value');
// A listener added afterwards should receive the value
- expect(errorGroup.done.then((_) => future),
- completion(equals('value')));
+ expect(errorGroup.done.then((_) => future), completion(equals('value')));
});
- test("should pipe an exception from the future to .done if the future "
- "doesn't have a listener", () {
+ test(
+ "should pipe an exception from the future to .done if the future "
+ "doesn't have a listener",
+ () {
expect(errorGroup.done, throwsFormatException);
completer.completeError(new FormatException());
@@ -131,8 +147,9 @@ main() {
}), completes);
});
- test("should pass a signaled exception to .done if the future doesn't have "
- "a listener",
+ test(
+ "should pass a signaled exception to .done if the future doesn't have "
+ "a listener",
() {
expect(errorGroup.done, throwsFormatException);
errorGroup.signalError(new FormatException());
@@ -159,8 +176,9 @@ main() {
future2 = errorGroup.registerFuture(completer2.future);
});
- test("should pipe exceptions from one future to the other and to "
- ".complete", () {
+ test(
+ "should pipe exceptions from one future to the other and to " ".complete",
+ () {
expect(future1, throwsFormatException);
expect(future2, throwsFormatException);
expect(errorGroup.done, throwsFormatException);
@@ -168,8 +186,9 @@ main() {
completer1.completeError(new FormatException());
});
- test("each future should be able to complete with a value "
- "independently", () {
+ test(
+ "each future should be able to complete with a value " "independently",
+ () {
expect(future1, completion(equals('value1')));
expect(future2, completion(equals('value2')));
expect(errorGroup.done, completes);
@@ -178,8 +197,10 @@ main() {
completer2.complete('value2');
});
- test("shouldn't throw a top-level exception if a future receives an error "
- "after the other listened future completes", () {
+ test(
+ "shouldn't throw a top-level exception if a future receives an error "
+ "after the other listened future completes",
+ () {
expect(future1, completion(equals('value')));
completer1.complete('value');
@@ -189,8 +210,10 @@ main() {
}), completes);
});
- test("shouldn't throw a top-level exception if an error is signaled after "
- "one listened future completes", () {
+ test(
+ "shouldn't throw a top-level exception if an error is signaled after "
+ "one listened future completes",
+ () {
expect(future1, completion(equals('value')));
completer1.complete('value');
@@ -224,25 +247,33 @@ main() {
});
expect(errorGroup.done, completes);
- controller..add(1)..add(2)..close();
+ controller
+ ..add(1)
+ ..add(2)
+ ..close();
});
- test('should pass through an error from the stream if it has a '
- 'listener', () {
+ test(
+ 'should pass through an error from the stream if it has a ' 'listener',
+ () {
expect(stream.first, throwsFormatException);
// errorGroup shouldn't top-level the exception
controller.addError(new FormatException());
});
- test('should notify the error group of an exception from the stream even '
- 'if it has a listener', () {
+ test(
+ 'should notify the error group of an exception from the stream even '
+ 'if it has a listener',
+ () {
expect(stream.first, throwsFormatException);
expect(errorGroup.done, throwsFormatException);
controller.addError(new FormatException());
});
- test('should pass a signaled exception to the stream if it has a listener '
- 'and should unsubscribe that stream', () {
+ 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
expect(stream.first, throwsFormatException);
errorGroup.signalError(new FormatException());
@@ -252,22 +283,27 @@ main() {
}), completes);
});
- test('should notify the error group of a signaled exception even if the '
- 'stream has a listener', () {
+ test(
+ 'should notify the error group of a signaled exception even if the '
+ 'stream has a listener',
+ () {
expect(stream.first, throwsFormatException);
expect(errorGroup.done, throwsFormatException);
errorGroup.signalError(new FormatException());
});
- test("should see one value and complete .done when the stream is done even "
- "if the stream doesn't have a listener", () {
+ test(
+ "should see one value and complete .done when the stream is done even "
+ "if the stream doesn't have a listener",
+ () {
expect(errorGroup.done, completes);
controller.add('value');
controller.close();
// Now that broadcast controllers have been removed a listener should
// see the value that has been put into the controller.
- expect(errorGroup.done.then((_) => stream.toList()),
+ expect(
+ errorGroup.done.then((_) => stream.toList()),
completion(equals(['value'])));
});
@@ -283,19 +319,24 @@ main() {
stream = errorGroup.registerStream(controller.stream);
});
- test("should complete .done when the stream is done even if the stream "
- "doesn't have a listener", () {
+ test(
+ "should complete .done when the stream is done even if the stream "
+ "doesn't have a listener",
+ () {
expect(errorGroup.done, completes);
controller.add('value');
controller.close();
// A listener added afterwards should receive the value
- expect(errorGroup.done.then((_) => stream.toList()),
+ expect(
+ errorGroup.done.then((_) => stream.toList()),
completion(equals(['value'])));
});
- test("should pipe an exception from the stream to .done if the stream "
- "doesn't have a listener", () {
+ test(
+ "should pipe an exception from the stream to .done if the stream "
+ "doesn't have a listener",
+ () {
expect(errorGroup.done, throwsFormatException);
controller.addError(new FormatException());
@@ -306,8 +347,9 @@ main() {
}), completes);
});
- test("should pass a signaled exception to .done if the stream doesn't "
- "have a listener",
+ test(
+ "should pass a signaled exception to .done if the stream doesn't "
+ "have a listener",
() {
expect(errorGroup.done, throwsFormatException);
errorGroup.signalError(new FormatException());
@@ -334,7 +376,8 @@ main() {
stream2 = errorGroup.registerStream(controller2.stream);
});
- test("should pipe exceptions from one stream to the other and to .done",
+ test(
+ "should pipe exceptions from one stream to the other and to .done",
() {
expect(stream1.first, throwsFormatException);
expect(stream2.first, throwsFormatException);
@@ -348,16 +391,28 @@ main() {
expect(stream2.toList(), completion(equals(['value2.1', 'value2.2'])));
expect(errorGroup.done, completes);
- controller1..add('value1.1')..add('value1.2')..close();
- controller2..add('value2.1')..add('value2.2')..close();
+ controller1
+ ..add('value1.1')
+ ..add('value1.2')
+ ..close();
+ controller2
+ ..add('value2.1')
+ ..add('value2.2')
+ ..close();
});
- test("shouldn't throw a top-level exception if a stream receives an error "
- "after the other listened stream completes", () {
+ 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'])));
- controller1..add('value1')..add('value2')..close();
+ expect(
+ stream1.toList().whenComplete(signal.complete),
+ completion(equals(['value1', 'value2'])));
+ controller1
+ ..add('value1')
+ ..add('value2')
+ ..close();
expect(signal.future.then((_) {
// shouldn't cause a top-level exception
@@ -365,12 +420,18 @@ main() {
}), completes);
});
- test("shouldn't throw a top-level exception if an error is signaled after "
- "one listened stream completes", () {
+ 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'])));
- controller1..add('value1')..add('value2')..close();
+ expect(
+ stream1.toList().whenComplete(signal.complete),
+ completion(equals(['value1', 'value2'])));
+ controller1
+ ..add('value1')
+ ..add('value2')
+ ..close();
expect(signal.future.then((_) {
// shouldn't cause a top-level exception
@@ -409,18 +470,25 @@ main() {
completer.completeError(new FormatException());
});
- test("the stream and the future should be able to complete/emit values "
- "independently", () {
+ test(
+ "the stream and the future should be able to complete/emit values "
+ "independently",
+ () {
expect(stream.toList(), completion(equals(['value1.1', 'value1.2'])));
expect(future, completion(equals('value2.0')));
expect(errorGroup.done, completes);
- controller..add('value1.1')..add('value1.2')..close();
+ controller
+ ..add('value1.1')
+ ..add('value1.2')
+ ..close();
completer.complete('value2.0');
});
- test("shouldn't throw a top-level exception if the stream receives an error "
- "after the listened future completes", () {
+ test(
+ "shouldn't throw a top-level exception if the stream receives an error "
+ "after the listened future completes",
+ () {
expect(future, completion(equals('value')));
completer.complete('value');
@@ -430,12 +498,18 @@ main() {
}), completes);
});
- test("shouldn't throw a top-level exception if the future receives an "
- "error after the listened stream completes", () {
+ 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'])));
- controller..add('value1')..add('value2')..close();
+ expect(
+ stream.toList().whenComplete(signal.complete),
+ completion(equals(['value1', 'value2'])));
+ controller
+ ..add('value1')
+ ..add('value2')
+ ..close();
expect(signal.future.then((_) {
// shouldn't cause a top-level exception

Powered by Google App Engine
This is Rietveld 408576698