aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core/fs_spec.lua
blob: c3d5fea71f572eedead6288c583c7b40adeee98d (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 "mason-core.fs"
local mason = require "mason"

describe("fs", function()
    before_each(function()
        mason.setup {
            install_root_dir = "/foo",
        }
    end)

    it(
        "refuses to rmrf paths outside of boundary",
        async_test(function()
            local e = assert.has.errors(function()
                fs.async.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/mason.nvim/issues/new]],
                e
            )
        end)
    )
end)