aboutsummaryrefslogtreecommitdiffstats
path: root/tests/core/fs_spec.lua
blob: 121c57d6cf7b41f7493f27aa8b61b6007bfe8d75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)