mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test Kernel.open accepts pathname object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
61397f6b13
commit
614537d5fa
1 changed files with 12 additions and 1 deletions
|
@ -1180,7 +1180,18 @@ if $0 == __FILE__
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_kernel_open
|
def test_kernel_open
|
||||||
assert_equal(1, Kernel.open(Pathname.new("/dev/null")) {|f| 1 })
|
count = 0
|
||||||
|
stat1 = File.stat(__FILE__)
|
||||||
|
result = Kernel.open(Pathname.new(__FILE__)) {|f|
|
||||||
|
stat2 = f.stat
|
||||||
|
assert_equal(stat1.dev, stat2.dev)
|
||||||
|
assert_equal(stat1.ino, stat2.ino)
|
||||||
|
assert_equal(stat1.size, stat2.size)
|
||||||
|
count += 1
|
||||||
|
2
|
||||||
|
}
|
||||||
|
assert_equal(1, count)
|
||||||
|
assert_equal(2, result)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue