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

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

Issue 1883293005: Allow opening a named pipe on MacOS and Linux. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix comments Created 4 years, 8 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
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/named_pipe_script_test.dart
diff --git a/tests/standalone/io/named_pipe_script_test.dart b/tests/standalone/io/named_pipe_script_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..83df7375b3726db33a26aca744e9f3604e9f87ce
--- /dev/null
+++ b/tests/standalone/io/named_pipe_script_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2016, 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.
+// Testing file input stream, VM-only, standalone test.
+
+import "dart:convert";
+import "dart:io";
+
+import "package:expect/expect.dart";
+
+main() {
+ // Reading a script from a named pipe is only supported on Linux and MacOS.
+ if (!Platform.isLinux && !Platform.isMacOS) {
+ return;
+ }
+
+ final String script = 'int main() {print("Hello, World!");}';
+ final String stdinPipePath = '/dev/fd/0';
+ StringBuffer output = new StringBuffer();
+ Process.start(Platform.executable, [stdinPipePath]).then((Process process) {
+ process.stdout.transform(UTF8.decoder).listen(output.write);
+ process.stderr.transform(UTF8.decoder).listen((data) {
+ Expect.fail(data);
+ });
+ process.stdin.writeln(script);
+ process.stdin.close();
+ process.exitCode.then((int status) {
+ Expect.equals(0, status);
+ Expect.equals("Hello, World!\n", output.toString());
+ });
+ });
+}
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698