| OLD | NEW |
| 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 command_line_config; | 5 library command_line_config; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:pathos/path.dart' as path; | 10 import 'package:pathos/path.dart' as path; |
| 11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 12 import '../lib/src/utils.dart'; | 12 import '../lib/src/utils.dart'; |
| 13 | 13 |
| 14 /// Gets a "special" string (ANSI escape or Unicode). On Windows, returns | 14 /// Pretty Unicode characters! |
| 15 /// something else since those aren't supported. | 15 final _checkbox = getSpecial('\u2713', 'PASS'); |
| 16 String _getSpecial(String color, [String onWindows = '']) { | 16 final _ballotX = getSpecial('\u2717', 'FAIL'); |
| 17 // No ANSI escapes on windows. | 17 final _lambda = getSpecial('\u03bb', '<fn>'); |
| 18 if (Platform.operatingSystem == 'windows') return onWindows; | |
| 19 return color; | |
| 20 } | |
| 21 | 18 |
| 22 /// Pretty Unicode characters! | 19 final _green = getSpecial('\u001b[32m'); |
| 23 final _checkbox = _getSpecial('\u2713', 'PASS'); | 20 final _red = getSpecial('\u001b[31m'); |
| 24 final _ballotX = _getSpecial('\u2717', 'FAIL'); | 21 final _magenta = getSpecial('\u001b[35m'); |
| 25 final _lambda = _getSpecial('\u03bb', '<fn>'); | 22 final _none = getSpecial('\u001b[0m'); |
| 26 | |
| 27 final _green = _getSpecial('\u001b[32m'); | |
| 28 final _red = _getSpecial('\u001b[31m'); | |
| 29 final _magenta = _getSpecial('\u001b[35m'); | |
| 30 final _none = _getSpecial('\u001b[0m'); | |
| 31 | 23 |
| 32 /// A custom unittest configuration for running the pub tests from the | 24 /// A custom unittest configuration for running the pub tests from the |
| 33 /// command-line and generating human-friendly output. | 25 /// command-line and generating human-friendly output. |
| 34 class CommandLineConfiguration extends Configuration { | 26 class CommandLineConfiguration extends Configuration { |
| 35 void onInit() { | 27 void onInit() { |
| 36 // Do nothing. Overridden to prevent the base class from printing. | 28 // Do nothing. Overridden to prevent the base class from printing. |
| 37 } | 29 } |
| 38 | 30 |
| 39 void onTestResult(TestCase testCase) { | 31 void onTestResult(TestCase testCase) { |
| 40 var result; | 32 var result; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 var library = match[2]; | 154 var library = match[2]; |
| 163 if (!isCore) { | 155 if (!isCore) { |
| 164 // Make the library path relative to the entrypoint. | 156 // Make the library path relative to the entrypoint. |
| 165 library = path.relative(library); | 157 library = path.relative(library); |
| 166 } | 158 } |
| 167 | 159 |
| 168 var member = match[1].replaceAll("<anonymous closure>", _lambda); | 160 var member = match[1].replaceAll("<anonymous closure>", _lambda); |
| 169 return new _StackFrame._(isCore, library, match[3], match[4], member); | 161 return new _StackFrame._(isCore, library, match[3], match[4], member); |
| 170 } | 162 } |
| 171 } | 163 } |
| OLD | NEW |