blob: 1a6d05d87d7cf419547d5d6a2fae016ea1ab773d [file] [log] [blame]
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
/// @assertion Future catchError(Function onError, {bool test(Object error)})
/// If test is omitted, it defaults to a function that always returns true.
/// @description Checks that [onError] is called if [test] is omitted and the
/// returned future completes with error thrown by [onError] call
/// @author
import "dart:async";
import "../../../Utils/expect.dart";
main() {
Completer completer = new Completer();
Future f = completer.future;
(Object error) {
Expect.equals("!", error);
throw "@";
(Object value){"returned future should complete with error");
onError: (Object error){
Expect.equals("@", error);