| Index: mojo/public/dart/third_party/stack_trace/test/utils.dart
|
| diff --git a/mojo/public/dart/third_party/stack_trace/test/utils.dart b/mojo/public/dart/third_party/stack_trace/test/utils.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..912f8f4ed007a5aace161296fdbe72ca58ab1083
|
| --- /dev/null
|
| +++ b/mojo/public/dart/third_party/stack_trace/test/utils.dart
|
| @@ -0,0 +1,37 @@
|
| +// Copyright (c) 2013, 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 stack_trace.test.utils;
|
| +
|
| +import 'package:test/test.dart';
|
| +
|
| +/// Returns a matcher that runs [matcher] against a [Frame]'s `member` field.
|
| +Matcher frameMember(matcher) =>
|
| + transform((frame) => frame.member, matcher, 'member');
|
| +
|
| +/// Returns a matcher that runs [matcher] against a [Frame]'s `library` field.
|
| +Matcher frameLibrary(matcher) =>
|
| + transform((frame) => frame.library, matcher, 'library');
|
| +
|
| +/// Returns a matcher that runs [transformation] on its input, then matches
|
| +/// the output against [matcher].
|
| +///
|
| +/// [description] should be a noun phrase that describes the relation of the
|
| +/// output of [transformation] to its input.
|
| +Matcher transform(transformation(value), matcher, String description) =>
|
| + new _TransformMatcher(transformation, wrapMatcher(matcher), description);
|
| +
|
| +class _TransformMatcher extends Matcher {
|
| + final Function _transformation;
|
| + final Matcher _matcher;
|
| + final String _description;
|
| +
|
| + _TransformMatcher(this._transformation, this._matcher, this._description);
|
| +
|
| + bool matches(item, Map matchState) =>
|
| + _matcher.matches(_transformation(item), matchState);
|
| +
|
| + Description describe(Description description) =>
|
| + description.add(_description).add(' ').addDescriptionOf(_matcher);
|
| +}
|
|
|