aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/fs_spec.lua
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-04-21 12:09:59 +0200
committerGitHub <noreply@github.com>2022-04-21 12:09:59 +0200
commitb68fcc6bb2c770495ff8e2508c06dfdd49abcc80 (patch)
treedf7c71efb59958deb21a18eeccf3e3c43c4cd704 /tests/core/fs_spec.lua
parentrun autogen_metadata.lua (diff)
downloadmason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.gz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.bz2
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.lz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.xz
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.tar.zst
mason-b68fcc6bb2c770495ff8e2508c06dfdd49abcc80.zip
chore: refactor remaining installers to async impl (#616)
Diffstat (limited to 'tests/core/fs_spec.lua')
-rw-r--r--tests/core/fs_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/core/fs_spec.lua b/tests/core/fs_spec.lua
new file mode 100644
index 00000000..121c57d6
--- /dev/null
+++ b/tests/core/fs_spec.lua
@@ -0,0 +1,24 @@
+local fs = require "nvim-lsp-installer.core.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 paths outside of boundary",
+ async_test(function()
+ local e = assert.has.errors(function()
+ fs.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/nvim-lsp-installer/issues/new]],
+ e
+ )
+ end)
+ )
+end)