Review: GzipWriter.open

GitDiff.bat 9fc3048beb4a315ec7ac3dc82908da8f92bf1a07
fb6f89146e331a9f20f444d5ca94478dfce7f555

  •     Implemented Zlib::GzipWriter.open
    
  •     Added Kernel.abort
    
  •     Mapped Errno::EACCES to System.UnauthorizedAccessException
    
  •     File.delete catches IOException and rethrows Errno::EACCES to 
    

match MRI

  •     Adds Errno::EXDEV
    
  •     Updated rbconfig.rb to work with the dev environment. Change 
    

RbConfig[:ruby_install_name] to “ir”. Note that it is not “ironruby”
because RubyGems uses this to spawn new processes for running setup
scripts, and so it needs to match the executable name (ir.exe).

  •     Added Languages\Ruby\Tests\Interop\uncategorized_spec.rb as a 
    

place for devs to add CLR tests. Jim can later move them into the right
place in CLR interop test suite.

Files modified:

Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/file/open_tags.txthttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-0
*
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/kernel/abort_tags.txt
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/core/file/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-2
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-3
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-4
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-5
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-6
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-7
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-8
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-9
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-10
*
Merlin/Main/Languages/Ruby/Libs/rbconfig.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-11
*
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-12
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb

Thanks,
Shri

  • it “raises TypeError unless the arguments are exactly a String,
    Fixnum and Fixnum” do
  • filename = mock(“filename”)
  • filename.should_not_receive(:to_s)
  • lambda { Zlib::GzipWriter.open(filename) }.should
    raise_error(TypeError)
  • level = mock(“level”)
  • level.should_not_receive(:to_int)
  • lambda { Zlib::GzipWriter.open(@filename, level) }.should
    raise_error(TypeError)
  • strategy = mock(“strategy”)
  • strategy.should_not_receive(:to_int)
  • lambda { Zlib::GzipWriter.open(@filename, 0, strategy) }.should
    raise_error(TypeError)
  • end

I would check to_i, not to_int in this case. Other than this and the
extra file, test looks good.
JD

From: Shri B.
Sent: Tuesday, April 07, 2009 1:09 PM
To: IronRuby External Code R.
Cc: [email protected]
Subject: Review: GzipWriter.open

GitDiff.bat 9fc3048beb4a315ec7ac3dc82908da8f92bf1a07
fb6f89146e331a9f20f444d5ca94478dfce7f555

  •     Implemented Zlib::GzipWriter.open
    
  •     Added Kernel.abort
    
  •     Mapped Errno::EACCES to System.UnauthorizedAccessException
    
  •     File.delete catches IOException and rethrows Errno::EACCES to 
    

match MRI

  •     Adds Errno::EXDEV
    
  •     Updated rbconfig.rb to work with the dev environment. Change 
    

RbConfig[:ruby_install_name] to “ir”. Note that it is not “ironruby”
because RubyGems uses this to spawn new processes for running setup
scripts, and so it needs to match the executable name (ir.exe).

  •     Added Languages\Ruby\Tests\Interop\uncategorized_spec.rb as a 
    

place for devs to add CLR tests. Jim can later move them into the right
place in CLR interop test suite.

Files modified:

Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/file/open_tags.txthttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-0
*
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/kernel/abort_tags.txt
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/core/file/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-2
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-3
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-4
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-5
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-6
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-7
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-8
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-9
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-10
*
Merlin/Main/Languages/Ruby/Libs/rbconfig.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-11
*
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-12
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb

Thanks,
Shri

Looks good.

Tomas

From: Shri B.
Sent: Tuesday, April 07, 2009 1:09 PM
To: IronRuby External Code R.
Cc: [email protected]
Subject: Review: GzipWriter.open

GitDiff.bat 9fc3048beb4a315ec7ac3dc82908da8f92bf1a07
fb6f89146e331a9f20f444d5ca94478dfce7f555

  •     Implemented Zlib::GzipWriter.open
    
  •     Added Kernel.abort
    
  •     Mapped Errno::EACCES to System.UnauthorizedAccessException
    
  •     File.delete catches IOException and rethrows Errno::EACCES to 
    

match MRI

  •     Adds Errno::EXDEV
    
  •     Updated rbconfig.rb to work with the dev environment. Change 
    

RbConfig[:ruby_install_name] to “ir”. Note that it is not “ironruby”
because RubyGems uses this to spawn new processes for running setup
scripts, and so it needs to match the executable name (ir.exe).

  •     Added Languages\Ruby\Tests\Interop\uncategorized_spec.rb as a 
    

place for devs to add CLR tests. Jim can later move them into the right
place in CLR interop test suite.

Files modified:

Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/file/open_tags.txthttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-0
*
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/kernel/abort_tags.txt
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/core/file/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-2
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-3
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-4
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-5
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-6
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-7
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-8
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-9
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-10
*
Merlin/Main/Languages/Ruby/Libs/rbconfig.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-11
*
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-12
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb

Thanks,
Shri

The following Ruby code prints “to_int”. So checking for to_int seems to
be correct, right?

class C
def to_int
puts “to_int”
0
end

def to_i
puts “to_i”
0
end
end

[].at(C.new)

Thanks,
Shri

From: Jim D.
Sent: Tuesday, April 07, 2009 1:25 PM
To: Shri B.; IronRuby External Code R.
Cc: [email protected]
Subject: RE: Review: GzipWriter.open

  • it “raises TypeError unless the arguments are exactly a String,
    Fixnum and Fixnum” do
  • filename = mock(“filename”)
  • filename.should_not_receive(:to_s)
  • lambda { Zlib::GzipWriter.open(filename) }.should
    raise_error(TypeError)
  • level = mock(“level”)
  • level.should_not_receive(:to_int)
  • lambda { Zlib::GzipWriter.open(@filename, level) }.should
    raise_error(TypeError)
  • strategy = mock(“strategy”)
  • strategy.should_not_receive(:to_int)
  • lambda { Zlib::GzipWriter.open(@filename, 0, strategy) }.should
    raise_error(TypeError)
  • end

I would check to_i, not to_int in this case. Other than this and the
extra file, test looks good.
JD

From: Shri B.
Sent: Tuesday, April 07, 2009 1:09 PM
To: IronRuby External Code R.
Cc: [email protected]
Subject: Review: GzipWriter.open

GitDiff.bat 9fc3048beb4a315ec7ac3dc82908da8f92bf1a07
fb6f89146e331a9f20f444d5ca94478dfce7f555

  •     Implemented Zlib::GzipWriter.open
    
  •     Added Kernel.abort
    
  •     Mapped Errno::EACCES to System.UnauthorizedAccessException
    
  •     File.delete catches IOException and rethrows Errno::EACCES to 
    

match MRI

  •     Adds Errno::EXDEV
    
  •     Updated rbconfig.rb to work with the dev environment. Change 
    

RbConfig[:ruby_install_name] to “ir”. Note that it is not “ironruby”
because RubyGems uses this to spawn new processes for running setup
scripts, and so it needs to match the executable name (ir.exe).

  •     Added Languages\Ruby\Tests\Interop\uncategorized_spec.rb as a 
    

place for devs to add CLR tests. Jim can later move them into the right
place in CLR interop test suite.

Files modified:

Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/file/open_tags.txthttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-0
*
Merlin/External/Languages/IronRuby/mspec/ironruby-tags/core/kernel/abort_tags.txt
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/core/file/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-2
*
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-3
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-4
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-5
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-6
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-7
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-8
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-9
*
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-10
*
Merlin/Main/Languages/Ruby/Libs/rbconfig.rbhttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-11
*
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cshttp://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-12
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb
*
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rbhttp://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb

Thanks,
Shri