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

Side by Side Diff: lib/src/utils.dart

Issue 1160453004: Support the latest version of the test package. (Closed) Base URL: git@github.com:dart-lang/metatest@master
Patch Set: Created 5 years, 6 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 | « lib/metatest.dart ('k') | pubspec.yaml » ('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) 2014, 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 metatest.utils;
6
7 /// Prepends each line in [text] with [prefix]. If [firstPrefix] is passed, the
8 /// first line is prefixed with that instead.
9 String prefixLines(String text, {String prefix: '| ', String firstPrefix}) {
10 var lines = text.split('\n');
11 if (firstPrefix == null) {
12 return lines.map((line) => '$prefix$line').join('\n');
13 }
14
15 var firstLine = "$firstPrefix${lines.first}";
16 lines = lines.skip(1).map((line) => '$prefix$line').toList();
17 lines.insert(0, firstLine);
18 return lines.join('\n');
19 }
OLDNEW
« no previous file with comments | « lib/metatest.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698