aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fs_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fs_spec.lua')
-rw-r--r--tests/fs_spec.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/fs_spec.lua b/tests/fs_spec.lua
new file mode 100644
index 00000000..e227b9da
--- /dev/null
+++ b/tests/fs_spec.lua
@@ -0,0 +1,18 @@
+local fs = require "nvim-lsp-installer.fs"
+local lsp_installer = require "nvim-lsp-installer"
+
+describe("fs", function()
+ before_each(function()
+ lsp_installer.settings {
+ install_root_dir = "/foo",
+ }
+ end)
+
+ it("refuses to rmrf unsafe paths", function()
+ local e = assert.has.errors(function()
+ fs.rmrf "/thisisa/path"
+ end)
+
+ assert.equal("Refusing to operate on path (/thisisa/path) outside of the servers root dir (/foo).", e)
+ end)
+end)