[Ironruby-core] Review: GzipWriter.open

Jim Deville jdeville at microsoft.com
Tue Apr 7 17:01:37 EDT 2009


My bad. These look fine as is then.

jD

-----Original Message-----
From: Shri Borde <Shri.Borde at microsoft.com>
Sent: April 07, 2009 1:47 PM
To: Jim Deville <jdeville at microsoft.com>; IronRuby External Code Reviewers <irbrev at microsoft.com>
Cc: ironruby-core at rubyforge.org <ironruby-core at rubyforge.org>
Subject: RE: Review: GzipWriter.open


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 Deville
Sent: Tuesday, April 07, 2009 1:25 PM
To: Shri Borde; IronRuby External Code Reviewers
Cc: ironruby-core at rubyforge.org
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 Borde
Sent: Tuesday, April 07, 2009 1:09 PM
To: IronRuby External Code Reviewers
Cc: ironruby-core at rubyforge.org
Subject: Review: GzipWriter.open

http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555
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.txt<http://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.rb<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-2>
  *   Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rb<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-3>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-4>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-5>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-6>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-7>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-8>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-9>
  *   Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-10>
  *   Merlin/Main/Languages/Ruby/Libs/rbconfig.rb<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-11>
  *   Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cs<http://github.com/shri/ironruby/commit/fb6f89146e331a9f20f444d5ca94478dfce7f555#diff-12>
  *   Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb<http://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb>
  *   Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb<http://github.com/shri/ironruby/tree/fb6f89146e331a9f20f444d5ca94478dfce7f555/Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb>

Thanks,
Shri

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090407/7f15afb9/attachment-0001.html>


More information about the Ironruby-core mailing list