[MacRuby/MacRuby] 82517d: IO#sysread will handle 2nd argument as buffer when...
Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: 82517df769fbcb81dbd3123066af0901f04d1073 https://github.com/MacRuby/MacRuby/commit/82517df769fbcb81dbd3123066af0901f0... Author: Watson <watson1978@gmail.com> Date: 2011-05-16 (Mon, 16 May 2011) Changed paths: M io.c Log Message: ----------- IO#sysread will handle 2nd argument as buffer when was passed Object which has to_str method. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions File.open("/tmp/foo", "w") {|f| f.write "01234567890123456789" } obj = Object.new $buffer = "abc" def obj.to_str $buffer end File.open("/tmp/foo") {|f| f.sysread(5, obj) assert_equal("01234", obj.to_str) assert_equal("01234", $buffer) } puts :ok }}}
participants (1)
-
noreply@github.com