Forum: IronRuby Review: GzipWriter.open

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-04-07 22:18
(Received via mailing list)
http://github.com/shri/ironruby/commit/fb6f89146e3...
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/fb6f89146e3...
 *
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/fb6f89146e3...
 *
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libs/rbconfig.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...
 *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...

Thanks,
Shri
Ade8632553a9243ae05fc920f68644c1?d=identicon&s=25 Jim Deville (Guest)
on 2009-04-07 22:31
(Received via mailing list)
+  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@rubyforge.org
Subject: Review: GzipWriter.open

http://github.com/shri/ironruby/commit/fb6f89146e3...
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/fb6f89146e3...
  *
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/fb6f89146e3...
  *
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Libs/rbconfig.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
  *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...
  *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...

Thanks,
Shri
Cb51033949ffccd982ae32c9f890f25a?d=identicon&s=25 Tomas Matousek (Guest)
on 2009-04-07 22:40
(Received via mailing list)
Looks good.

Tomas

From: Shri Borde
Sent: Tuesday, April 07, 2009 1:09 PM
To: IronRuby External Code Reviewers
Cc: ironruby-core@rubyforge.org
Subject: Review: GzipWriter.open

http://github.com/shri/ironruby/commit/fb6f89146e3...
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/fb6f89146e3...
 *
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/fb6f89146e3...
 *
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libs/rbconfig.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...
 *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...

Thanks,
Shri
Aea6cfe04952626ab630bde47ff82f89?d=identicon&s=25 Shri Borde (Guest)
on 2009-04-07 23:54
(Received via mailing list)
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@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@rubyforge.org
Subject: Review: GzipWriter.open

http://github.com/shri/ironruby/commit/fb6f89146e3...
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/fb6f89146e3...
 *
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/fb6f89146e3...
 *
Merlin/External/Languages/IronRuby/mspec/rubyspec/library/zlib/gzipwriter/open_spec.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Dir.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/Errno.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/FileOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/KernelOps.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Builtins/StringFormatter.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Initializers.Generated.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libraries.LCA_RESTRICTED/Zlib/zlib.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Libs/rbconfig.rb<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyObject.cs<http://github.com/shri/ironruby/commit/fb6f89146e3...
 *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_spec.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...
 *
Merlin/Main/Languages/Ruby/Tests/Interop/uncategorized_specs.rb<http://github.com/shri/ironruby/tree/fb6f89146e331...

Thanks,
Shri
This topic is locked and can not be replied to.