From d7e233566543d4c83199f5644f90bb116d7070f2 Mon Sep 17 00:00:00 2001 From: William Boman Date: Sat, 25 Dec 2021 15:11:42 +0100 Subject: add some tests (#360) --- tests/fs_spec.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/fs_spec.lua (limited to 'tests/fs_spec.lua') 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) -- cgit v1.2.3-70-g09d2