diff options
| author | William Boman <william@redwill.se> | 2026-05-30 15:52:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-30 15:52:15 +0200 |
| commit | 6daa74748ff63efcf24fb66112412c03df08be72 (patch) | |
| tree | df2a931b1f19cf43fc24e4b733cd83ab07d21b50 /tests | |
| parent | fix(fs): implement rmrf natively via libuv (#2098) (diff) | |
| download | mason-6daa74748ff63efcf24fb66112412c03df08be72.tar mason-6daa74748ff63efcf24fb66112412c03df08be72.tar.gz mason-6daa74748ff63efcf24fb66112412c03df08be72.tar.bz2 mason-6daa74748ff63efcf24fb66112412c03df08be72.tar.lz mason-6daa74748ff63efcf24fb66112412c03df08be72.tar.xz mason-6daa74748ff63efcf24fb66112412c03df08be72.tar.zst mason-6daa74748ff63efcf24fb66112412c03df08be72.zip | |
refactor(fs): implement mkdirp natively via libuv (#2100)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-core/fs_spec.lua | 13 | ||||
| -rw-r--r-- | tests/mason-core/installer/linker_spec.lua | 12 |
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) |
