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

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

Issue 12324004: Add test for whether a completer or stream controller has been closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« sdk/lib/async/future.dart ('K') | « tests/lib/async/future_test.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 'dart:async'; 8 import 'dart:async';
9 import 'event_helper.dart'; 9 import 'event_helper.dart';
10 10
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 sentEvents = new Events() 385 sentEvents = new Events()
386 ..add(5)..add(6)..add(4)..add(6)..add(8)..add(3)..add(4)..add(1)..close(); 386 ..add(5)..add(6)..add(4)..add(6)..add(8)..add(3)..add(4)..add(1)..close();
387 expectedEvents = new Events() 387 expectedEvents = new Events()
388 ..add(5)..add(4)..add(3)..add(1)..close(); 388 ..add(5)..add(4)..add(3)..add(1)..close();
389 // Use 'distinct' as a filter with access to the previously emitted event. 389 // Use 'distinct' as a filter with access to the previously emitted event.
390 actualEvents = new Events.capture(c.stream.distinct((a, b) => a < b)); 390 actualEvents = new Events.capture(c.stream.distinct((a, b) => a < b));
391 sentEvents.replay(c); 391 sentEvents.replay(c);
392 Expect.listEquals(expectedEvents.events, actualEvents.events); 392 Expect.listEquals(expectedEvents.events, actualEvents.events);
393 } 393 }
394 394
395 testClosed() {
396 for (StreamController c in [new StreamController(),
397 new StreamController.broadcast()]) {
398 Expect.isFalse(c.isClosed);
399 c.add(42);
400 Expect.isFalse(c.isClosed);
401 c.signalError("bad");
402 Expect.isFalse(c.isClosed);
403 c.close();
404 Expect.isTrue(c.isClosed);
405 }
406 }
407
395 main() { 408 main() {
396 testMultiController(); 409 testMultiController();
397 testSingleController(); 410 testSingleController();
398 testExtraMethods(); 411 testExtraMethods();
412 testClosed();
399 } 413 }
OLDNEW
« sdk/lib/async/future.dart ('K') | « tests/lib/async/future_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698