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 |
index a0f46690eb06907ace8062ae3f8611e0ec15e52a..643ae7a95b73c459cd420634c2005160cc422590 100644 |
--- a/tests/standalone/io/ansi_supported_test.dart |
+++ b/tests/standalone/io/ansi_supported_test.dart |
@@ -6,18 +6,30 @@ import 'dart:io'; |
import "package:expect/expect.dart"; |
-main() { |
+testStdout(Stdout s) { |
try { |
- Platform.ansiSupported; |
- } catch (e, s) { |
- Expect.fail("Platform.ansiSupported threw: $e\n$s\n"); |
+ s.supportsAnsiEscapes; |
+ } catch (e, st) { |
+ Expect.fail("$s.supportsAnsiEscapes threw: $e\n$st\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.'); |
+ Expect.isNotNull(s.supportsAnsiEscapes); |
+ Expect.isTrue(s.supportsAnsiEscapes is bool); |
+ if (s.supportsAnsiEscapes) { |
+ s.writeln('\x1b[31mThis text has a red foreground using SGR.31.'); |
+ s.writeln('\x1b[39mThis text has restored the foreground color.'); |
} else { |
- stdout.writeln('ANSI codes not supported on this platform'); |
+ s.writeln('ANSI escape codes are not supported on this platform'); |
+ } |
+} |
+ |
+main() { |
+ testStdout(stdout); |
+ testStdout(stderr); |
+ try { |
+ stdin.supportsAnsiEscapes; |
+ } catch (e, st) { |
+ Expect.fail("stdin.supportsAnsiEscapes threw: $e\n$st\n"); |
} |
+ Expect.isNotNull(stdin.supportsAnsiEscapes); |
+ Expect.isTrue(stdin.supportsAnsiEscapes is bool); |
} |