implement File::Stat#size

This commit is contained in:
Mislav Marohnić 2009-11-27 13:48:03 +01:00 committed by Scott Taylor
parent 7f601eb7fc
commit 4530cb1e31
2 changed files with 9 additions and 0 deletions

View File

@ -192,6 +192,10 @@ module FakeFS
def nlink
FileSystem.find(@file).links.size
end
def size
File.size(@file)
end
end
attr_reader :path

View File

@ -67,4 +67,9 @@ class FileStatTest < Test::Unit::TestCase
assert_equal 2, File.stat("testfile").nlink
end
def test_file_size
File.open('testfile', 'w') { |f| f << 'test' }
assert_equal 4, File.stat('testfile').size
end
end