public
Description: Rubinius, the Ruby VM
Homepage: http://rubini.us
Clone URL: git://github.com/evanphx/rubinius.git
IO#write returns 0 when writing a blank string, to match behavior of MRI

Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
adamwiggins (author)
Sat Apr 26 22:57:09 -0700 2008
dbussink (committer)
Sun Apr 27 02:48:23 -0700 2008
commit  4a1f39426fc60ae7c2ed0470259fa0752a46d030
tree    a984cd937787d1d59432848e34becef4bd27be8e
parent  56c0088f9b075769933c8c87e3c2d256cff3a3e8
...
497
498
499
500
 
501
502
503
...
497
498
499
 
500
501
502
503
0
@@ -497,7 +497,7 @@ class IO
0
 
0
     data = String data
0
 
0
-    return if data.length == 0
0
+    return if data.length == 0
0
     raise IOError if ((Platform::POSIX.fcntl(@descriptor, F_GETFL, 0) & ACCMODE) == RDONLY)
0
     prim_write(data)
0
   end
...
33
34
35
 
 
 
 
36
37
...
33
34
35
36
37
38
39
40
41
0
@@ -33,5 +33,9 @@ describe "IO#write on a file" do
0
     lambda { @readonly_file.write("") }.should_not raise_error
0
   end
0
 
0
+  it "returns a length of 0 when writing a blank string" do
0
+    @file.write('').should == 0
0
+  end
0
+
0
   it_behaves_like(:io_write, :write)
0
 end

Comments