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

Unified Diff: pkg/unittest/lib/src/utils.dart

Issue 807193003: Re-apply "Remove unittest and matcher from the repo." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/unittest/lib/src/test_environment.dart ('k') | pkg/unittest/lib/test_controller.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/utils.dart
diff --git a/pkg/unittest/lib/src/utils.dart b/pkg/unittest/lib/src/utils.dart
deleted file mode 100644
index 877cfb2263bacbd10358da47ac2e77d74a963d99..0000000000000000000000000000000000000000
--- a/pkg/unittest/lib/src/utils.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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 unittest.utils;
-
-import 'package:stack_trace/stack_trace.dart';
-
-/// Indent each line in [str] by two spaces.
-String indent(String str) =>
- str.replaceAll(new RegExp("^", multiLine: true), " ");
-
-/// A pair of values.
-class Pair<E, F> {
- final E first;
- final F last;
-
- Pair(this.first, this.last);
-
- String toString() => '($first, $last)';
-
- bool operator ==(other) {
- if (other is! Pair) return false;
- return other.first == first && other.last == last;
- }
-
- int get hashCode => first.hashCode ^ last.hashCode;
-}
-
-/// Returns a Trace object from a StackTrace object or a String, or the
-/// unchanged input if formatStacks is false;
-Trace getTrace(stack, bool formatStacks, bool filterStacks) {
- Trace trace;
- if (stack == null || !formatStacks) return null;
- if (stack is String) {
- trace = new Trace.parse(stack);
- } else if (stack is StackTrace) {
- trace = new Trace.from(stack);
- } else {
- throw new Exception('Invalid stack type ${stack.runtimeType} for $stack.');
- }
-
- if (!filterStacks) return trace;
-
- // Format the stack trace by removing everything above TestCase._runTest,
- // which is usually going to be irrelevant. Also fold together unittest and
- // core library calls so only the function the user called is visible.
- return new Trace(trace.frames.takeWhile((frame) {
- return frame.package != 'unittest' || frame.member != 'TestCase._runTest';
- })).terse.foldFrames((frame) => frame.package == 'unittest' || frame.isCore);
-}
« no previous file with comments | « pkg/unittest/lib/src/test_environment.dart ('k') | pkg/unittest/lib/test_controller.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698