aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mason-core/fs_spec.lua13
-rw-r--r--tests/mason-core/installer/linker_spec.lua12
2 files changed, 19 insertions, 6 deletions
diff --git a/tests/mason-core/fs_spec.lua b/tests/mason-core/fs_spec.lua
index 9df22578..3962b8cd 100644
--- a/tests/mason-core/fs_spec.lua
+++ b/tests/mason-core/fs_spec.lua
@@ -18,4 +18,17 @@ describe("fs", function()
e
)
end)
+
+ it("should mkdirp", function()
+ local temp = vim.fn.tempname()
+ local nested = vim.fs.joinpath(temp, "nested", "directory", "here")
+
+ assert.has_error(function()
+ assert(vim.uv.fs_stat(nested))
+ end)
+
+ fs.sync.mkdirp(nested)
+ local stat = assert(vim.uv.fs_stat(nested), "fs_stat returned no value")
+ assert.equals("directory", stat.type)
+ end)
end)
diff --git a/tests/mason-core/installer/linker_spec.lua b/tests/mason-core/installer/linker_spec.lua
index 6bf63a14..f2835f34 100644
--- a/tests/mason-core/installer/linker_spec.lua
+++ b/tests/mason-core/installer/linker_spec.lua
@@ -110,7 +110,7 @@ describe("linker", function()
it("should symlink share files", function()
local ctx = test_helpers.create_context()
- stub(fs.async, "mkdirp")
+ stub(fs.sync, "mkdirp")
stub(fs.async, "dir_exists")
stub(fs.async, "file_exists")
stub(fs.async, "symlink")
@@ -142,8 +142,8 @@ describe("linker", function()
.spy(fs.async.symlink)
.was_called_with("../../../packages/dummy/nested/path/to/share-file", ctx.location:share "nested/path/share-file")
- assert.spy(fs.async.mkdirp).was_called(2)
- assert.spy(fs.async.mkdirp).was_called_with(ctx.location:share "nested/path")
+ assert.spy(fs.sync.mkdirp).was_called(2)
+ assert.spy(fs.sync.mkdirp).was_called_with(ctx.location:share "nested/path")
end)
it("should copy share files on Windows", function()
@@ -155,7 +155,7 @@ describe("linker", function()
platform.is.unix = false
platform.is.win = true
- stub(fs.async, "mkdirp")
+ stub(fs.sync, "mkdirp")
stub(fs.async, "dir_exists")
stub(fs.async, "file_exists")
stub(fs.async, "copy_file")
@@ -189,7 +189,7 @@ describe("linker", function()
{ excl = true }
)
- assert.spy(fs.async.mkdirp).was_called(2)
- assert.spy(fs.async.mkdirp).was_called_with(ctx.location:share "nested/path")
+ assert.spy(fs.sync.mkdirp).was_called(2)
+ assert.spy(fs.sync.mkdirp).was_called_with(ctx.location:share "nested/path")
end)
end)