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

Unified Diff: tests/lib/async/stream_controller_async_test.dart

Issue 13548002: Add Iterable.fold (and Stream.fold) which replace `reduce`. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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
« no previous file with comments | « tests/html/streams_test.dart ('k') | tests/standalone/io/http_auth_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/async/stream_controller_async_test.dart
diff --git a/tests/lib/async/stream_controller_async_test.dart b/tests/lib/async/stream_controller_async_test.dart
index 2e329d38b3291f496d3c430a4224195050fb0eb2..98fd749acde4826578a88e8ab559c43a01ccff9b 100644
--- a/tests/lib/async/stream_controller_async_test.dart
+++ b/tests/lib/async/stream_controller_async_test.dart
@@ -11,11 +11,11 @@ import '../../../pkg/unittest/lib/unittest.dart';
import 'event_helper.dart';
testController() {
- // Test reduce
- test("StreamController.reduce", () {
+ // Test fold
+ test("StreamController.fold", () {
StreamController c = new StreamController.broadcast();
Stream stream = c.stream;
- stream.reduce(0, (a,b) => a + b)
+ stream.fold(0, (a,b) => a + b)
.then(expectAsync1((int v) {
Expect.equals(42, v);
}));
@@ -24,10 +24,10 @@ testController() {
c.close();
});
- test("StreamController.reduce throws", () {
+ test("StreamController.fold throws", () {
StreamController c = new StreamController.broadcast();
Stream stream = c.stream;
- stream.reduce(0, (a,b) { throw "Fnyf!"; })
+ stream.fold(0, (a,b) { throw "Fnyf!"; })
.catchError(expectAsync1((e) { Expect.equals("Fnyf!", e.error); }));
c.add(42);
});
@@ -50,20 +50,20 @@ testController() {
}
testSingleController() {
- test("Single-subscription StreamController.reduce", () {
+ test("Single-subscription StreamController.fold", () {
StreamController c = new StreamController();
Stream stream = c.stream;
- stream.reduce(0, (a,b) => a + b)
+ stream.fold(0, (a,b) => a + b)
.then(expectAsync1((int v) { Expect.equals(42, v); }));
c.add(10);
c.add(32);
c.close();
});
- test("Single-subscription StreamController.reduce throws", () {
+ test("Single-subscription StreamController.fold throws", () {
StreamController c = new StreamController();
Stream stream = c.stream;
- stream.reduce(0, (a,b) { throw "Fnyf!"; })
+ stream.fold(0, (a,b) { throw "Fnyf!"; })
.catchError(expectAsync1((e) { Expect.equals("Fnyf!", e.error); }));
c.add(42);
});
@@ -449,6 +449,7 @@ testRethrow() {
testFuture("min", (s, act) => s.min((a, b) => act(b)));
testFuture("max", (s, act) => s.max((a, b) => act(b)));
testFuture("reduce", (s, act) => s.reduce(0, (a,b) => act(b)));
+ testFuture("fold", (s, act) => s.fold(0, (a,b) => act(b)));
}
main() {
« no previous file with comments | « tests/html/streams_test.dart ('k') | tests/standalone/io/http_auth_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698