aboutsummaryrefslogtreecommitdiffstats
path: root/tests/minimal_init.vim
blob: 35bc2bcb811cfb1a5edb1e5cd6a380b65a634537 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
" Avoid neovim/neovim#11362
set display=lastline
set directory=""
set noswapfile

let $lsp_installer = getcwd()
let $luassertx_rtp = getcwd() .. "/tests/luassertx"
let $dependencies = getcwd() .. "/dependencies"

set rtp+=$lsp_installer,$luassertx_rtp
set packpath=$dependencies

packloadall

lua <<EOF
local server = require("nvim-lsp-installer.server")
function ServerGenerator(opts)
    return server.Server:new(vim.tbl_deep_extend("force", {
        name = "dummy",
        languages = { "dummylang" },
        root_dir = server.get_server_root_path("dummy"),
        homepage = "https://dummylang.org",
        installer = function(_, callback, ctx)
            ctx.stdio_sink.stdout "Installing dummy!\n"
            callback(true)
        end
    }, opts))
end

function FailingServerGenerator(opts)
    return ServerGenerator(vim.tbl_deep_extend("force", {
        installer = function(_, callback, ctx)
            ctx.stdio_sink.stdout "Installing failing dummy!\n"
            callback(false)
        end
    }, opts))
end
EOF

" Luassert extensions
lua require("luassertx")

lua <<EOF
require("nvim-lsp-installer").settings {
    install_root_dir = os.getenv("INSTALL_ROOT_DIR"),
}
EOF

function! RunTests() abort
    lua <<EOF
    require("plenary.test_harness").test_directory(os.getenv("FILE") or "./tests", {
        minimal_init = vim.fn.getcwd() .. "/tests/minimal_init.vim",
    })
EOF
endfunction