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

Side by Side Diff: tests/lib/async/stream_controller_test.dart

Issue 14242008: Fix skipWhile. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/stream_pipe.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.singleSubscription. 5 // Test the basic StreamController and StreamController.singleSubscription.
6 library stream_controller_test; 6 library stream_controller_test;
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 import 'event_helper.dart'; 10 import 'event_helper.dart';
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 354
355 c = new StreamController(); 355 c = new StreamController();
356 expectedEvents = new Events()..add(3)..close(); 356 expectedEvents = new Events()..add(3)..close();
357 actualEvents = new Events.capture(c.stream.skipWhile((x) => x <= 2)); 357 actualEvents = new Events.capture(c.stream.skipWhile((x) => x <= 2));
358 sentEvents.replay(c); 358 sentEvents.replay(c);
359 Expect.listEquals(expectedEvents.events, actualEvents.events); 359 Expect.listEquals(expectedEvents.events, actualEvents.events);
360 360
361 361
362 c = new StreamController(); 362 c = new StreamController();
363 expectedEvents = new Events()..add(2)..add(3)..close();
364 actualEvents = new Events.capture(c.stream.skipWhile((x) => x <= 1));
365 sentEvents.replay(c);
366 Expect.listEquals(expectedEvents.events, actualEvents.events);
367
368
369 c = new StreamController();
370 expectedEvents = new Events()..add(1)..add(2)..add(3)..close();
371 actualEvents = new Events.capture(c.stream.skipWhile((x) => false));
372 sentEvents.replay(c);
373 Expect.listEquals(expectedEvents.events, actualEvents.events);
374
375
376 c = new StreamController();
363 expectedEvents = new Events()..add(1)..add(2)..close(); 377 expectedEvents = new Events()..add(1)..add(2)..close();
364 actualEvents = new Events.capture(c.stream.take(2)); 378 actualEvents = new Events.capture(c.stream.take(2));
365 sentEvents.replay(c); 379 sentEvents.replay(c);
366 Expect.listEquals(expectedEvents.events, actualEvents.events); 380 Expect.listEquals(expectedEvents.events, actualEvents.events);
367 381
368 382
369 c = new StreamController(); 383 c = new StreamController();
370 expectedEvents = new Events()..add(1)..add(2)..close(); 384 expectedEvents = new Events()..add(1)..add(2)..close();
371 actualEvents = new Events.capture(c.stream.takeWhile((x) => x <= 2)); 385 actualEvents = new Events.capture(c.stream.takeWhile((x) => x <= 2));
372 sentEvents.replay(c); 386 sentEvents.replay(c);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 c.close(); 418 c.close();
405 Expect.isTrue(c.isClosed); 419 Expect.isTrue(c.isClosed);
406 } 420 }
407 421
408 main() { 422 main() {
409 testMultiController(); 423 testMultiController();
410 testSingleController(); 424 testSingleController();
411 testExtraMethods(); 425 testExtraMethods();
412 testClosed(); 426 testClosed();
413 } 427 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream_pipe.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698