diff options
Diffstat (limited to 'tests/mason-core/fs_spec.lua')
| -rw-r--r-- | tests/mason-core/fs_spec.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/mason-core/fs_spec.lua b/tests/mason-core/fs_spec.lua index 3962b8cd..22a467fe 100644 --- a/tests/mason-core/fs_spec.lua +++ b/tests/mason-core/fs_spec.lua @@ -31,4 +31,28 @@ describe("fs", function() local stat = assert(vim.uv.fs_stat(nested), "fs_stat returned no value") assert.equals("directory", stat.type) end) + + it("should check if file_exists", function() + local temp = vim.fn.tempname() + + assert.is_false(fs.sync.file_exists(temp)) + fs.sync.write_file(temp, "") + assert.is_true(fs.sync.file_exists(temp)) + + local temp_dir = vim.fn.tempname() + fs.sync.mkdir(temp_dir) + assert.is_false(fs.sync.file_exists(temp_dir)) + end) + + it("should check if dir_exists", function() + local temp = vim.fn.tempname() + + assert.is_false(fs.sync.dir_exists(temp)) + fs.sync.mkdir(temp) + assert.is_true(fs.sync.dir_exists(temp)) + + local temp_file = vim.fn.tempname() + fs.sync.write_file(temp_file, "") + assert.is_false(fs.sync.dir_exists(temp_file)) + end) end) |
