diff options
| author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-22 16:31:06 +0000 |
|---|---|---|
| committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-04-22 16:31:06 +0000 |
| commit | 3192a485d25f48e5c7492c953f181b7a373e4eaa (patch) | |
| tree | a6b370f42b1e910d78c50a0035eb1909f08ef93a /test/zlib | |
| parent | 3909c0237c013a21e29a3e27d1c94c3520d262f6 (diff) | |
| download | ruby-3192a485d25f48e5c7492c953f181b7a373e4eaa.tar.gz ruby-3192a485d25f48e5c7492c953f181b7a373e4eaa.tar.xz ruby-3192a485d25f48e5c7492c953f181b7a373e4eaa.zip | |
* ext/zlib/zlib.c (Zlib::GzipFile#path): New method.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/zlib')
| -rw-r--r-- | test/zlib/test_zlib.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 9e4cf8003..aa3059d5b 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -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 |
