summaryrefslogtreecommitdiffstats
path: root/tests/mason-core/fs_spec.lua
blob: 9df22578d17fd8f5d9c5b60d624e23c63ef7fd2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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", function()
        local e = assert.has_error(function()
            fs.sync.rmrf "/thisisa/path"
        end)

        assert.equals(
            [[Refusing to rmrf "/thisisa/path" which is outside of the allowed boundary "/foo". Please report this error at https://github.com/mason-org/mason.nvim/issues/new]],
            e
        )
    end)
end)