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

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

Issue 598993002: Add missing null-tests to async error functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add co19 issue number to status file. Created 6 years, 2 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 | « tests/co19/co19-co19.status ('k') | tests/lib/async/stream_controller_async_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library future_test; 5 library future_test;
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 Expect.fail("Shouldn't happen"); 670 Expect.fail("Shouldn't happen");
671 }, onError: (Future f) { 671 }, onError: (Future f) {
672 f.then((v) { 672 f.then((v) {
673 Expect.equals(42, v); 673 Expect.equals(42, v);
674 asyncEnd(); 674 asyncEnd();
675 }); 675 });
676 }); 676 });
677 } 677 }
678 678
679 void testCompleteErrorWithNull() { 679 void testCompleteErrorWithNull() {
680 asyncStart();
680 final completer = new Completer<int>(); 681 final completer = new Completer<int>();
681 Expect.throws(() => completer.completeError(null)); 682 completer.future.catchError((e) {
683 Expect.isTrue(e is NullThrownError);
684 asyncEnd();
685 });
686 completer.completeError(null);
682 } 687 }
683 688
684 void testChainedFutureValue() { 689 void testChainedFutureValue() {
685 final completer = new Completer(); 690 final completer = new Completer();
686 final future = completer.future; 691 final future = completer.future;
687 asyncStart(); 692 asyncStart();
688 693
689 future.then((v) => new Future.value(v * 2)) 694 future.then((v) => new Future.value(v * 2))
690 .then((v) { 695 .then((v) {
691 Expect.equals(42, v); 696 Expect.equals(42, v);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 _realFuture.then(action, onError: onError); 816 _realFuture.then(action, onError: onError);
812 Future catchError(Function onError, {bool test(e)}) => 817 Future catchError(Function onError, {bool test(e)}) =>
813 _realFuture.catchError(onError, test: test); 818 _realFuture.catchError(onError, test: test);
814 Future whenComplete(action()) => _realFuture.whenComplete(action); 819 Future whenComplete(action()) => _realFuture.whenComplete(action);
815 Future timeout(Duration timeLimit, {void onTimeout()}) => 820 Future timeout(Duration timeLimit, {void onTimeout()}) =>
816 _realFuture.timeout(timeLimit, onTimeout: onTimeout); 821 _realFuture.timeout(timeLimit, onTimeout: onTimeout);
817 Stream asStream() => _realFuture.asStream(); 822 Stream asStream() => _realFuture.asStream();
818 String toString() => "CustomFuture@${_realFuture.hashCode}"; 823 String toString() => "CustomFuture@${_realFuture.hashCode}";
819 int get hashCode => _realFuture.hashCode; 824 int get hashCode => _realFuture.hashCode;
820 } 825 }
OLDNEW
« no previous file with comments | « tests/co19/co19-co19.status ('k') | tests/lib/async/stream_controller_async_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698