Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Side by Side Diff: packages/stack_trace/test/utils.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/stack_trace/test/trace_test.dart ('k') | packages/stack_trace/test/vm_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library stack_trace.test.utils;
6
7 import 'package:test/test.dart';
8
9 /// Returns a matcher that runs [matcher] against a [Frame]'s `member` field.
10 Matcher frameMember(matcher) =>
11 transform((frame) => frame.member, matcher, 'member');
12
13 /// Returns a matcher that runs [matcher] against a [Frame]'s `library` field.
14 Matcher frameLibrary(matcher) =>
15 transform((frame) => frame.library, matcher, 'library');
16
17 /// Returns a matcher that runs [transformation] on its input, then matches
18 /// the output against [matcher].
19 ///
20 /// [description] should be a noun phrase that describes the relation of the
21 /// output of [transformation] to its input.
22 Matcher transform(transformation(value), matcher, String description) =>
23 new _TransformMatcher(transformation, wrapMatcher(matcher), description);
24
25 class _TransformMatcher extends Matcher {
26 final Function _transformation;
27 final Matcher _matcher;
28 final String _description;
29
30 _TransformMatcher(this._transformation, this._matcher, this._description);
31
32 bool matches(item, Map matchState) =>
33 _matcher.matches(_transformation(item), matchState);
34
35 Description describe(Description description) =>
36 description.add(_description).add(' ').addDescriptionOf(_matcher);
37 }
OLDNEW
« no previous file with comments | « packages/stack_trace/test/trace_test.dart ('k') | packages/stack_trace/test/vm_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698