blob: 25b2096a412d6954f228b00babf5a1e58dc6cdb7 [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)})
/// The test function should not throw, but if it does, it is handled as if
/// the onError function had thrown.
/// @description Checks that if [test] function throws an error, then returned
/// future is completed with this error.
/// @author
import "dart:async";
import "../../../Utils/expect.dart";
main() {
new Future.error("!")
(Object error) {"The onError should not be executed, if test throws");
test:(Object error){
Expect.equals("!", error);
throw "@";
(Object value) {"returned future should complete with error");
onError: (Object error){
Expect.equals("@", error);