diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-07 05:32:26 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-07 05:32:26 +0000 |
commit | 08907d87e01ba0181b90603e27ec83cd9c285ad8 (patch) | |
tree | 9be583b9846b2277e9855bae4bd8c77223fef3b8 /test/zlib/test_zlib.rb | |
parent | eb136f8643857119206ccb360e6b85a951a72e5a (diff) | |
download | ruby-08907d87e01ba0181b90603e27ec83cd9c285ad8.tar.gz |
add test for [ruby-dev:24060], [ruby-dev:24065], [ruby-dev:24103],
[ruby-dev:24190], [ruby-dev:24191], [ruby-dev:24194], [ruby-dev:24197],
[ruby-dev:24202], [ruby-dev:24213], [ruby-dev:24223] and [ruby-dev:24228].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib/test_zlib.rb')
-rw-r--r-- | test/zlib/test_zlib.rb | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 48e074750f..5a646cf8de 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -13,16 +13,46 @@ if defined? Zlib def test_read0 assert_equal("", Zlib::GzipReader.new(StringIO.new(D0)).read(0)) end + + def test_ungetc # [ruby-dev:24060] + s = "" + w = Zlib::GzipWriter.new(StringIO.new(s)) + w << (1...1000).to_a.inspect + w.close + r = Zlib::GzipReader.new(StringIO.new(s)) + r.read(100) + r.ungetc ?a + assert_nothing_raised { + r.read(100) + r.read + r.close + } + end + + def test_ungetc_paragraph # [ruby-dev:24065] + s = "" + w = Zlib::GzipWriter.new(StringIO.new(s)) + w << "abc" + w.close + r = Zlib::GzipReader.new(StringIO.new(s)) + $/ = "" + r.ungetc ?\n + assert_equal("abc", r.gets) + assert_nothing_raised { + r.read + r.close + } + end end class TestZlibGzipWriter < Test::Unit::TestCase def test_invalid_new # [ruby-dev:23228] - assert_raises(NoMethodError) { Zlib::GzipWriter.new(nil).close } + assert_raise(NoMethodError) { Zlib::GzipWriter.new(nil).close } # [ruby-dev:23344] - assert_raises(NoMethodError) { Zlib::GzipWriter.new(true).close } - assert_raises(NoMethodError) { Zlib::GzipWriter.new(0).close } - assert_raises(NoMethodError) { Zlib::GzipWriter.new(:hoge).close } + assert_raise(NoMethodError) { Zlib::GzipWriter.new(true).close } + assert_raise(NoMethodError) { Zlib::GzipWriter.new(0).close } + assert_raise(NoMethodError) { Zlib::GzipWriter.new(:hoge).close } end end end |