aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core/fs_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mason-core/fs_spec.lua')
-rw-r--r--tests/mason-core/fs_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/mason-core/fs_spec.lua b/tests/mason-core/fs_spec.lua
new file mode 100644
index 00000000..c3d5fea7
--- /dev/null
+++ b/tests/mason-core/fs_spec.lua
@@ -0,0 +1,24 @@
+local fs = require "mason-core.fs"
+local mason = require "mason"
+
+describe("fs", function()
+ before_each(function()
+ mason.setup {
+ install_root_dir = "/foo",
+ }
+ end)
+
+ it(
+ "refuses to rmrf paths outside of boundary",
+ async_test(function()
+ local e = assert.has.errors(function()
+ fs.async.rmrf "/thisisa/path"
+ end)
+
+ assert.equal(
+ [[Refusing to rmrf "/thisisa/path" which is outside of the allowed boundary "/foo". Please report this error at https://github.com/williamboman/mason.nvim/issues/new]],
+ e
+ )
+ end)
+ )
+end)