fileinfo: implement os_fileinfo_size

this replaces os_get_file_size and file_info.stat.st_size
This commit is contained in:
Stefan Hoffmann
2014-08-08 16:25:33 +02:00
parent 3051015f89
commit aa378acdf5
6 changed files with 35 additions and 23 deletions

View File

@@ -597,6 +597,20 @@ describe('fs function', function()
end)
end)
describe('os_fileinfo_size', function()
it('returns the correct size of a file', function()
local path = 'unit-test-directory/test.file'
local file = io.open(path, 'w')
file:write('some bytes to get filesize != 0')
file:flush()
file:close()
local size = lfs.attributes(path, 'size')
local file_info = file_info_new()
assert.is_true(fs.os_get_file_info(path, file_info))
eq(size, fs.os_fileinfo_size(file_info))
end)
end)
describe('os_get_file_id', function()
it('returns false if given an non-existing file', function()
local file_id = file_id_new()