| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 error_group_test; | 5 library error_group_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import '../../../pkg/unittest/lib/unittest.dart'; | 9 import '../../../pkg/unittest/lib/unittest.dart'; |
| 10 import '../../pub/error_group.dart'; | 10 import '../../pub/error_group.dart'; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 expect(stream.toList(), completion(equals(['value1', 'value2']))); | 444 expect(stream.toList(), completion(equals(['value1', 'value2']))); |
| 445 controller..add('value1')..add('value2')..close(); | 445 controller..add('value1')..add('value2')..close(); |
| 446 | 446 |
| 447 expect(stream.toList().then((_) { | 447 expect(stream.toList().then((_) { |
| 448 // shouldn't cause a top-level exception | 448 // shouldn't cause a top-level exception |
| 449 completer.completeError(new FormatException()); | 449 completer.completeError(new FormatException()); |
| 450 }), completes); | 450 }), completes); |
| 451 }); | 451 }); |
| 452 }); | 452 }); |
| 453 } | 453 } |
| 454 | |
| 455 // TODO(nweiz): remove this once it's built in to unittest (issue 7922). | |
| 456 /// A matcher for StateErrors. | |
| 457 const isStateError = const _StateError(); | |
| 458 | |
| 459 /// A matcher for functions that throw StateError. | |
| 460 const Matcher throwsStateError = | |
| 461 const Throws(isStateError); | |
| 462 | |
| 463 class _StateError extends TypeMatcher { | |
| 464 const _StateError() : super("StateError"); | |
| 465 bool matches(item, MatchState matchState) => item is StateError; | |
| 466 } | |
| OLD | NEW |