aboutsummaryrefslogtreecommitdiffstats
path: root/test/zlib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 09:18:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-21 09:18:34 +0000
commitb6ef272d025387e6707088ba2f9cef3b9031d2db (patch)
tree190b49f514b59163a44d62dccdaec4f0cc89176b /test/zlib
parentd423b884b8d95b878d66de1abc2efa300f8971e2 (diff)
downloadruby-b6ef272d025387e6707088ba2f9cef3b9031d2db.tar.gz
* ext/zlib/zlib.c: remove obsolete prototype macros.
* ext/zlib/zlib.c (struct gzfile): add encoding field to gzfile structure. * ext/zlib/zlib.c (rb_gzreader_getc): now works on characters. * ext/zlib/zlib.c (rb_gzreader_getbyte): new method to retrieve single byte. * ext/zlib/zlib.c (rb_gzreader_readbyte): ditto. * ext/zlib/zlib.c (rb_gzreader_each_byte): renamed from each_char * ext/zlib/zlib.c (rb_gzreader_ungetc): allow unget strings. * ext/zlib/zlib.c (rb_gzreader_ungetbyte): renamed from ungetc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index fe8cee5622..5746f036ea 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -470,10 +470,20 @@ if defined? Zlib
Zlib::GzipWriter.open(t.path) {|gz| gz.print("foobar") }
f = Zlib::GzipReader.open(t.path)
- "foobar".each_byte {|c| assert_equal(c, f.getc) }
+ "foobar".each_char {|c| assert_equal(c, f.getc) }
assert_nil(f.getc)
end
+ def test_getbyte
+ t = Tempfile.new("test_zlib_gzip_reader")
+ t.close
+ Zlib::GzipWriter.open(t.path) {|gz| gz.print("foobar") }
+
+ f = Zlib::GzipReader.open(t.path)
+ "foobar".each_byte {|c| assert_equal(c, f.getbyte) }
+ assert_nil(f.getbyte)
+ end
+
def test_readchar
t = Tempfile.new("test_zlib_gzip_reader")
t.close