Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions test/pathname/test_pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -649,14 +649,15 @@ def test_to_s
end

def test_kernel_open
count = 0
result = Kernel.open(Pathname.new(__FILE__)) {|f|
assert_file.identical?(__FILE__, f)
count += 1
2
}
assert_equal(1, count)
assert_equal(2, result)
token = sprintf("%s\#%s|%d|%.8x", self.class.name, __method__, $$, rand(0x1_0000_0000))
Dir.mktmpdir("rubytest-pathname") do |dir|
path = Pathname.new(dir) + "file"
File.write(path, token)
assert_equal(token, File.read(path))
assert_equal(token, Kernel.open(path, &:read))
ensure
File.unlink(path)
end
end

def test_each_filename
Expand Down