aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fs_spec.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-12-25 15:11:42 +0100
committerGitHub <noreply@github.com>2021-12-25 15:11:42 +0100
commitd7e233566543d4c83199f5644f90bb116d7070f2 (patch)
treeecfcb6e5abb937ee976eed6daac1bf2ab3bac51d /tests/fs_spec.lua
parentfix: dont pass nil opts (diff)
downloadmason-d7e233566543d4c83199f5644f90bb116d7070f2.tar
mason-d7e233566543d4c83199f5644f90bb116d7070f2.tar.gz
mason-d7e233566543d4c83199f5644f90bb116d7070f2.tar.bz2
mason-d7e233566543d4c83199f5644f90bb116d7070f2.tar.lz
mason-d7e233566543d4c83199f5644f90bb116d7070f2.tar.xz
mason-d7e233566543d4c83199f5644f90bb116d7070f2.tar.zst
mason-d7e233566543d4c83199f5644f90bb116d7070f2.zip
add some tests (#360)
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)