diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-21 17:17:08 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-21 17:17:08 +0000 |
commit | 6d0b1d8a8691460189caee88bfbef2dd129b48bd (patch) | |
tree | be892e3518f0b5f0a0555cd9c996e62ccab5e5ba /test | |
parent | 10957cd1cc65dfa5c0c8d1f5d96caa8ac787467c (diff) |
merge revision(s) 49661,49662,49664:
test_file_exhaustive.rb: remove useless assignment
* test/ruby/test_file_exhaustive.rb (make_tmp_filename): not
assign to instance variable, @hardlinkfile.
* file.c (rb_file_identical_p): fix handle leak, ensure to close
the handle of the first argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 0c16a01453..b347e53d16 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -46,7 +46,7 @@ class TestFileExhaustive < Test::Unit::TestCase end def make_tmp_filename(prefix) - @hardlinkfile = @dir + "/" + prefix + File.basename(__FILE__) + ".#{$$}.test" + "#{@dir}/#{prefix}#{File.basename(__FILE__)}.#{$$}.test" end def test_path @@ -291,13 +291,30 @@ class TestFileExhaustive < Test::Unit::TestCase assert_file.not_sticky?(@file) end - def test_identical_p + def test_path_identical_p assert_file.identical?(@file, @file) assert_file.not_identical?(@file, @zerofile) assert_file.not_identical?(@file, @nofile) assert_file.not_identical?(@nofile, @file) end + def test_io_identical_p + open(@file) {|f| + assert_file.identical?(f, f) + assert_file.identical?(@file, f) + assert_file.identical?(f, @file) + } + end + + def test_closed_io_identical_p + io = open(@file) {|f| f} + assert_raise(IOError) { + File.identical?(@file, io) + } + File.unlink(@file) + assert_file.not_exist?(@file) + end + def test_s_size assert_integer(File.size(@dir)) assert_equal(3, File.size(@file)) |