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

Unified Diff: tests/standalone/io/ansi_supported_test.dart

Issue 2739683005: [dart:io] Adds Platform.ansiSupported (Closed)
Patch Set: Cleanup Created 3 years, 9 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
« runtime/bin/platform_win.cc ('K') | « sdk/lib/io/platform_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/ansi_supported_test.dart
diff --git a/tests/standalone/io/ansi_supported_test.dart b/tests/standalone/io/ansi_supported_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a0f46690eb06907ace8062ae3f8611e0ec15e52a
--- /dev/null
+++ b/tests/standalone/io/ansi_supported_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2017, 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.
+
+import 'dart:io';
+
+import "package:expect/expect.dart";
+
+main() {
+ try {
+ Platform.ansiSupported;
+ } catch (e, s) {
+ Expect.fail("Platform.ansiSupported threw: $e\n$s\n");
+ }
+ Expect.isNotNull(Platform.ansiSupported);
+ Expect.isTrue(Platform.ansiSupported is bool);
+ if (stdout.hasTerminal && Platform.ansiSupported) {
+ stdout.writeln('\x1b[31mThis text has a red foreground using SGR.31.');
+ stdout.writeln('\x1b[39mThis text has restored the foreground color.');
+ } else {
+ stdout.writeln('ANSI codes not supported on this platform');
+ }
+}
« runtime/bin/platform_win.cc ('K') | « sdk/lib/io/platform_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698