aboutsummaryrefslogtreecommitdiff
path: root/test/unit/os/fs_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/os/fs_spec.lua')
-rw-r--r--test/unit/os/fs_spec.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index c92c1513b7..9f6d110e8f 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -47,6 +47,7 @@ describe('fs function', function()
os.remove('unit-test-directory/test.file')
os.remove('unit-test-directory/test_2.file')
os.remove('unit-test-directory/test_link.file')
+ os.remove('unit-test-directory/test_hlink.file')
lfs.rmdir('unit-test-directory')
end)
@@ -611,6 +612,19 @@ describe('fs function', function()
end)
end)
+ describe('os_fileinfo_hardlinks', function()
+ it('returns the correct number of hardlinks', function()
+ local path = 'unit-test-directory/test.file'
+ local path_link = 'unit-test-directory/test_hlink.file'
+ local file_info = file_info_new()
+ assert.is_true(fs.os_get_file_info(path, file_info))
+ eq(1, fs.os_fileinfo_hardlinks(file_info))
+ lfs.link(path, path_link)
+ assert.is_true(fs.os_get_file_info(path, file_info))
+ eq(2, fs.os_fileinfo_hardlinks(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()