| OLD | NEW |
| (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 } | |
| OLD | NEW |