aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os/fs_spec.lua
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-08-09 14:59:52 +0200
committerStefan Hoffmann <stefan991@gmail.com>2014-08-31 15:33:23 +0200
commit9ee1c3604c0cc8a3ec1bac32fb33e9c0d0887155 (patch)
tree3abe9a5632adaceb7890bf76e260e671b2d46b2f /test/unit/os/fs_spec.lua
parente85fe0957d40080f43cbfcbe9eb8864475325b09 (diff)
downloadrneovim-9ee1c3604c0cc8a3ec1bac32fb33e9c0d0887155.tar.gz
rneovim-9ee1c3604c0cc8a3ec1bac32fb33e9c0d0887155.tar.bz2
rneovim-9ee1c3604c0cc8a3ec1bac32fb33e9c0d0887155.zip
fileinfo: implement os_fileinfo_blocksize
Diffstat (limited to 'test/unit/os/fs_spec.lua')
-rw-r--r--test/unit/os/fs_spec.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index 9f6d110e8f..696e6f15cc 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -625,6 +625,27 @@ describe('fs function', function()
end)
end)
+ describe('os_fileinfo_blocksize', function()
+ it('returns the correct blocksize of a file', function()
+ local path = 'unit-test-directory/test.file'
+ -- there is a bug in luafilesystem where
+ -- `lfs.attributes path, 'blksize'` returns the worng value:
+ -- https://github.com/keplerproject/luafilesystem/pull/44
+ -- using this workaround for now:
+ local blksize = lfs.attributes(path).blksize
+ local file_info = file_info_new()
+ assert.is_true(fs.os_get_file_info(path, file_info))
+ if blksize then
+ eq(blksize, fs.os_fileinfo_blocksize(file_info))
+ else
+ -- luafs dosn't support blksize on windows
+ -- libuv on windows returns a constant value as blocksize
+ -- checking for this constant value should be enough
+ eq(2048, fs.os_fileinfo_blocksize(file_info))
+ end
+ end)
+ end)
+
describe('os_get_file_id', function()
it('returns false if given an non-existing file', function()
local file_id = file_id_new()