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..00525e1255657084c452c80aba13a2379843383a 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.ansiSupported; |
+ } catch (e, st) { |
+ Expect.fail("$s.ansiSupported 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.ansiSupported); |
+ Expect.isTrue(s.ansiSupported is bool); |
+ if (s.ansiSupported) { |
+ 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 codes not supported on this platform'); |
+ } |
+} |
+ |
+main() { |
+ testStdout(stdout); |
+ testStdout(stderr); |
+ try { |
+ stdin.ansiSupported; |
+ } catch (e, st) { |
+ Expect.fail("stdin.ansiSupported threw: $e\n$st\n"); |
} |
+ Expect.isNotNull(stdin.ansiSupported); |
+ Expect.isTrue(stdin.ansiSupported is bool); |
} |