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

Unified Diff: lib/src/io.dart

Issue 913123006: Add a ConsoleReporter for printing human-friendly test progress reports. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« lib/src/console_reporter.dart ('K') | « lib/src/console_reporter.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/io.dart
diff --git a/lib/src/io.dart b/lib/src/io.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b279f3ee0ed62abbf51846a3d5684890847b5772
--- /dev/null
+++ b/lib/src/io.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2015, 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.io;
+
+import 'dart:io';
+
+/// Whether "special" strings such as Unicode characters or color escapes are
+/// safe to use.
+///
+/// On Windows or when not printing to a terminal, only printable ASCII
+/// characters should be used.
+bool get canUseSpecialChars =>
+ Platform.operatingSystem != 'windows' &&
+ stdioType(stdout) == StdioType.TERMINAL;
+
+/// Gets a "special" string (ANSI escape or Unicode).
+///
+/// On Windows or when not printing to a terminal, returns something else since
+/// those aren't supported.
+String getSpecial(String special, [String onWindows = '']) =>
+ canUseSpecialChars ? special : onWindows;
« lib/src/console_reporter.dart ('K') | « lib/src/console_reporter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698