35a0b4fd6c
This also adds support for [StringScanner.error], which produces a nicely-formatted scanning error. R=kevmoo@google.com Review URL: https://codereview.chromium.org//222843003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34669 260f80e4-7a28-3924-810f-c04153c831b5
18 lines
594 B
Dart
18 lines
594 B
Dart
// Copyright (c) 2014, 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.
|
|
|
|
library string_scanner.test.utils;
|
|
|
|
import 'package:unittest/unittest.dart';
|
|
|
|
/// Returns a matcher that asserts that a closure throws a [FormatException]
|
|
/// with the given [message].
|
|
Matcher throwsFormattedError(String message) {
|
|
return throwsA(predicate((error) {
|
|
expect(error, isFormatException);
|
|
expect(error.message, equals(message));
|
|
return true;
|
|
}));
|
|
}
|