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

Side by Side Diff: third_party/dart-packages/unittest/unittest/src/utils.dart

Issue 971083002: Create an apptesting framework for dart. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
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 unittest.utils; 5 library unittest.utils;
6 6
7 import '../../stack_trace/stack_trace.dart'; 7 import 'package:stack_trace/stack_trace.dart';
8 8
9 /// Indent each line in [str] by two spaces. 9 /// Indent each line in [str] by two spaces.
10 String indent(String str) => 10 String indent(String str) =>
11 str.replaceAll(new RegExp("^", multiLine: true), " "); 11 str.replaceAll(new RegExp("^", multiLine: true), " ");
12 12
13 /// A pair of values. 13 /// A pair of values.
14 class Pair<E, F> { 14 class Pair<E, F> {
15 final E first; 15 final E first;
16 final F last; 16 final F last;
17 17
(...skipping 24 matching lines...) Expand all
42 42
43 if (!filterStacks) return trace; 43 if (!filterStacks) return trace;
44 44
45 // Format the stack trace by removing everything above TestCase._runTest, 45 // Format the stack trace by removing everything above TestCase._runTest,
46 // which is usually going to be irrelevant. Also fold together unittest and 46 // which is usually going to be irrelevant. Also fold together unittest and
47 // core library calls so only the function the user called is visible. 47 // core library calls so only the function the user called is visible.
48 return new Trace(trace.frames.takeWhile((frame) { 48 return new Trace(trace.frames.takeWhile((frame) {
49 return frame.package != 'unittest' || frame.member != 'TestCase._runTest'; 49 return frame.package != 'unittest' || frame.member != 'TestCase._runTest';
50 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore); 50 })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore);
51 } 51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698