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

Side by Side Diff: packages/unittest/lib/vm_config.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/unittest/lib/unittest.dart ('k') | packages/unittest/out.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /// A simple unit test library for running tests on the VM. 5 /// A simple unit test library for running tests on the VM.
6 library unittest.vm_config; 6 library unittest.vm_config;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'unittest.dart'; 10 import 'unittest.dart';
11 11
12 class VMConfiguration extends SimpleConfiguration { 12 class VMConfiguration extends SimpleConfiguration {
13 // Color constants used for generating messages. 13 // Color constants used for generating messages.
14 final String GREEN_COLOR = '\u001b[32m'; 14 final String GREEN_COLOR = '\u001b[32m';
15 final String RED_COLOR = '\u001b[31m'; 15 final String RED_COLOR = '\u001b[31m';
16 final String MAGENTA_COLOR = '\u001b[35m'; 16 final String MAGENTA_COLOR = '\u001b[35m';
17 final String NO_COLOR = '\u001b[0m'; 17 final String NO_COLOR = '\u001b[0m';
18 18
19 // We make this public so the user can turn it off if they want. 19 // We make this public so the user can turn it off if they want.
20 bool useColor; 20 bool useColor;
21 21
22 VMConfiguration() 22 VMConfiguration()
23 : super(), 23 : useColor = stdioType(stdout) == StdioType.TERMINAL,
24 useColor = stdioType(stdout) == StdioType.TERMINAL; 24 super();
25 25
26 String formatResult(TestCase testCase) { 26 String formatResult(TestCase testCase) {
27 String result = super.formatResult(testCase); 27 String result = super.formatResult(testCase);
28 if (useColor) { 28 if (useColor) {
29 if (testCase.result == PASS) { 29 if (testCase.result == PASS) {
30 return "${GREEN_COLOR}${result}${NO_COLOR}"; 30 return "${GREEN_COLOR}${result}${NO_COLOR}";
31 } else if (testCase.result == FAIL) { 31 } else if (testCase.result == FAIL) {
32 return "${RED_COLOR}${result}${NO_COLOR}"; 32 return "${RED_COLOR}${result}${NO_COLOR}";
33 } else if (testCase.result == ERROR) { 33 } else if (testCase.result == ERROR) {
34 return "${MAGENTA_COLOR}${result}${NO_COLOR}"; 34 return "${MAGENTA_COLOR}${result}${NO_COLOR}";
(...skipping 21 matching lines...) Expand all
56 exit(status); 56 exit(status);
57 }); 57 });
58 } 58 }
59 } 59 }
60 60
61 void useVMConfiguration() { 61 void useVMConfiguration() {
62 unittestConfiguration = _singleton; 62 unittestConfiguration = _singleton;
63 } 63 }
64 64
65 final _singleton = new VMConfiguration(); 65 final _singleton = new VMConfiguration();
OLDNEW
« no previous file with comments | « packages/unittest/lib/unittest.dart ('k') | packages/unittest/out.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698