mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 16:42:42 +00:00
fileinfo: implement os_fileinfo_size
this replaces os_get_file_size and file_info.stat.st_size
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user