1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/zlib/zlib.c (Zlib::GzipFile#path): New method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2009-04-22 16:31:06 +00:00
parent 5f956fda43
commit 2bb576e5ac
5 changed files with 73 additions and 1 deletions

View file

@ -363,6 +363,34 @@ if defined? Zlib
assert_equal(3, gz.tell)
end
end
def test_path
t = Tempfile.new("test_zlib_gzip_file")
t.close
gz = Zlib::GzipWriter.open(t.path)
gz.print("foo")
assert_equal(t.path, gz.path)
gz.close
assert_equal(t.path, gz.path)
f = Zlib::GzipReader.open(t.path)
assert_equal(t.path, f.path)
f.close
assert_equal(t.path, f.path)
s = ""
sio = StringIO.new(s)
gz = Zlib::GzipWriter.new(sio)
gz.print("foo")
assert_raise(NoMethodError) { gz.path }
gz.close
sio = StringIO.new(s)
f = Zlib::GzipReader.new(sio)
assert_raise(NoMethodError) { f.path }
f.close
end
end
class TestZlibGzipReader < Test::Unit::TestCase