[macruby-changes] [MacRuby/MacRuby] a7cefe: implement the StringIO#ungetbyte method.

noreply at github.com noreply at github.com
Sat Oct 15 01:33:21 PDT 2011


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby

  Commit: a7cefe4dbd854da41595bb121d532bfc9e337954
      https://github.com/MacRuby/MacRuby/commit/a7cefe4dbd854da41595bb121d532bfc9e337954
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-10-15 (Sat, 15 Oct 2011)

  Changed paths:
    M lib/stringio.rb

  Log Message:
  -----------
  implement the StringIO#ungetbyte method.


  Commit: edf3e01d0c0b4ccd367e79314cb679bae2e24f18
      https://github.com/MacRuby/MacRuby/commit/edf3e01d0c0b4ccd367e79314cb679bae2e24f18
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-10-15 (Sat, 15 Oct 2011)

  Changed paths:
    M lib/stringio.rb

  Log Message:
  -----------
  StringIO#ungetc will raise an exception when closed a reading stream and passed a nil.

----
require 'stringio'
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

io = StringIO.new("A")
io.close_read
assert_raise(IOError) { io.ungetc(nil) }


  Commit: c1fae99d6f03136f87c0124c269b1202b8838868
      https://github.com/MacRuby/MacRuby/commit/c1fae99d6f03136f87c0124c269b1202b8838868
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-10-15 (Sat, 15 Oct 2011)

  Changed paths:
    M lib/stringio.rb

  Log Message:
  -----------
  StringIO#write will raise an exception when closed a writing stream and passed a n empty string.

----
require 'stringio'
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

io = StringIO.new("hello")
io.close_write
assert_raise(IOError) { io.write("") }

io = StringIO.new("hello".freeze)
assert_raise(IOError) { io.write("") }


  Commit: d62d8646ebd6d738be294d5964286b775fb19e6f
      https://github.com/MacRuby/MacRuby/commit/d62d8646ebd6d738be294d5964286b775fb19e6f
  Author: Watson <watson1978 at gmail.com>
  Date:   2011-10-15 (Sat, 15 Oct 2011)

  Changed paths:
    M lib/stringio.rb

  Log Message:
  -----------
  StringIO#getc will raise an exception when closed a reading stream.

----
require 'stringio'
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

io = StringIO.new("hello")
io.close_read
assert_raise(IOError) { io.getc }


Compare: https://github.com/MacRuby/MacRuby/compare/c1fa682...d62d864


More information about the macruby-changes mailing list