From c814ec80c7d06c14f4b38f6c537ef186a92d73e3 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 21 Oct 2008 09:18:34 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@19869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/zlib/test_zlib.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index fe8cee562..5746f036e 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 -- cgit