[macruby-changes] [2208] MacRuby/branches/experimental/spec/frozen/library/stringio

source_changes at macosforge.org source_changes at macosforge.org
Tue Aug 4 03:01:48 PDT 2009


Revision: 2208
          http://trac.macosforge.org/projects/ruby/changeset/2208
Author:   mattaimonetti at gmail.com
Date:     2009-08-04 03:01:47 -0700 (Tue, 04 Aug 2009)
Log Message:
-----------
updated the stringio specs

Modified Paths:
--------------
    MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_copy_spec.rb
    MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_spec.rb
    MacRuby/branches/experimental/spec/frozen/library/stringio/shared/eof.rb

Modified: MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_copy_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_copy_spec.rb	2009-08-04 08:01:44 UTC (rev 2207)
+++ MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_copy_spec.rb	2009-08-04 10:01:47 UTC (rev 2208)
@@ -7,11 +7,14 @@
     @orig_io = StringIO.new("Original StringIO")
   end
   
-  it "is private" do
-    ruby_version_is "" ... "1.9" do
+  ruby_version_is "" ... "1.9" do
+    it "is private" do
       @io.private_methods.should include('initialize_copy')
     end
-    ruby_version_is "1.9" do
+  end  
+    
+  ruby_version_is "1.9" do
+    it "is private" do
       @io.private_methods.should include(:initialize_copy)
     end
   end

Modified: MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_spec.rb	2009-08-04 08:01:44 UTC (rev 2207)
+++ MacRuby/branches/experimental/spec/frozen/library/stringio/initialize_spec.rb	2009-08-04 10:01:47 UTC (rev 2208)
@@ -9,68 +9,68 @@
   it "uses the passed Object as the StringIO backend" do
     @io.send(:initialize, str = "example", "r")
     @io.string.should equal(str)
-  end
+  end   
 
   it "sets the mode based on the passed mode" do
     io = StringIO.allocate
     io.send(:initialize, "example", "r")
     io.closed_read?.should be_false
     io.closed_write?.should be_true
-
+      
     io = StringIO.allocate
     io.send(:initialize, "example", "rb")
     io.closed_read?.should be_false
     io.closed_write?.should be_true
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "r+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "rb+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "w")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "wb")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "w+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "wb+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "a")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "ab")
     io.closed_read?.should be_true
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "a+")
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-
+    
     io = StringIO.allocate
     io.send(:initialize, "example", "ab+")
     io.closed_read?.should be_false
-    io.closed_write?.should be_false
+    io.closed_write?.should be_false        
   end
 
   it "allows passing the mode as an Integer" do
@@ -108,7 +108,7 @@
     io.send(:initialize, "example", IO::RDWR | IO::APPEND)
     io.closed_read?.should be_false
     io.closed_write?.should be_false
-  end
+  end    
   
   ruby_version_is "" ... "1.9" do
      it "raises a TypeError when passed a frozen String in truncate mode as StringIO backend" do
@@ -122,7 +122,7 @@
       io = StringIO.allocate
       lambda { io.send(:initialize, "example".freeze, IO::TRUNC) }.should raise_error(RuntimeError)
     end
-  end 
+  end  
 
   it "tries to convert the passed mode to a String using #to_str" do
     obj = mock('to_str')
@@ -137,10 +137,10 @@
     (str = "example").freeze
     lambda { @io.send(:initialize, str, "r+") }.should raise_error(Errno::EACCES)
     lambda { @io.send(:initialize, str, "w") }.should raise_error(Errno::EACCES)
-    lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)
-  end
+    lambda { @io.send(:initialize, str, "a") }.should raise_error(Errno::EACCES)  
+  end   
 end
-
+     
 describe "StringIO#initialize when passed [Object]" do
   before(:each) do
     @io = StringIO.allocate
@@ -171,17 +171,20 @@
     @io.closed_write?.should be_true
   end
 end
-
+      
 describe "StringIO#initialize when passed no arguments" do
   before(:each) do
     @io = StringIO.allocate
   end
 
-  it "is private" do
-    ruby_version_is "" ... "1.9" do
+  ruby_version_is "" ... "1.9" do
+    it "is private" do
       @io.private_methods.should include('initialize')
     end
-    ruby_version_is "1.9" do
+  end 
+  
+  ruby_version_is "1.9" do
+    it "is private" do
       @io.private_methods.should include(:initialize)
     end
   end
@@ -196,4 +199,4 @@
     @io.send(:initialize)
     @io.string.should == ""
   end
-end
+end                

Modified: MacRuby/branches/experimental/spec/frozen/library/stringio/shared/eof.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/stringio/shared/eof.rb	2009-08-04 08:01:44 UTC (rev 2207)
+++ MacRuby/branches/experimental/spec/frozen/library/stringio/shared/eof.rb	2009-08-04 10:01:47 UTC (rev 2208)
@@ -21,4 +21,9 @@
     @io.pos = 2
     @io.send(@method).should be_false
   end
+  
+  it "raises an error if the io isn't readable" do
+    @io.close
+    lambda{ @io.send(@method)}.should raise_error(IOError)
+  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090804/de14cb9d/attachment.html>


More information about the macruby-changes mailing list