public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
IO.popen specs for reading and writing to pipes
adamwiggins (author)
Sun Apr 20 14:53:41 -0700 2008
febuiles (committer)
Sun Apr 20 15:53:16 -0700 2008
commit  10df9f89189637b2c5a54b01a88eca6c9fbb4601
tree    84358ae13e2c77b1626dbab1296097eef7379a26
parent  1af4a3eebef3a62a79a439807d7444d5ce1d7a31
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
5
6
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -1,6 +1,21 @@
0
 require File.dirname(__FILE__) + '/../../spec_helper'
0
 
0
 describe "IO#popen" do
0
+  it "reads from a read-only pipe" do
0
+    IO.popen("echo foo", "r") do |pipe|
0
+      pipe.read.should == "foo\n"
0
+    end
0
+  end
0
+
0
+  platform_is_not :mswin32 do
0
+    it "writes to a read/write pipe" do
0
+      IO.popen("cat", "r+") do |pipe|
0
+        pipe.write("bar")
0
+        pipe.read 3
0
+      end.should == "bar"
0
+    end
0
+  end
0
+
0
   it "with block does not raise error when io closed inside the block" do
0
     lambda {
0
       @io = IO.popen(RUBY_NAME, "r+") { |io| io.close; io }
...
 
1
2
...
1
2
3
0
@@ -1,2 +1,3 @@
0
+fails:writes to a read/write pipe
0
 fails:IO#popen with block does not raise error when io closed inside the block
0
 incomplete:IO.popen needs to be reviewed for spec completeness

Comments