Refresh generated neovim config
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#!/nix/store/agkxax48k35wdmkhmmija2i2sxg8i7ny-bash-5.2p26/bin/bash
|
||||
#!/nix/store/4bj2kxdm1462fzcc2i2s4dn33g2angcc-bash-5.2p32/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ describe("fuzzer", function()
|
||||
vim.api.nvim_set_current_buf(bufnr)
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, true, buf_content)
|
||||
vim.bo[bufnr].modified = false
|
||||
runner.apply_format(0, buf_content, expected, nil, false)
|
||||
runner.apply_format(0, buf_content, expected, nil, false, false, false)
|
||||
assert.are.same(expected, vim.api.nvim_buf_get_lines(0, 0, -1, false))
|
||||
end
|
||||
|
||||
|
||||
@ -4,11 +4,6 @@ local injected = require("conform.formatters.injected")
|
||||
local runner = require("conform.runner")
|
||||
local test_util = require("tests.test_util")
|
||||
|
||||
-- injected formatter only supported on neovim 0.9+
|
||||
if vim.fn.has("nvim-0.9") == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
---@param dir string
|
||||
---@return string[]
|
||||
local function list_test_files(dir)
|
||||
|
||||
@ -59,11 +59,36 @@ describe("runner", function()
|
||||
local config = assert(conform.get_formatter_config("test"))
|
||||
local ctx = runner.build_context(0, config)
|
||||
local filename = vim.api.nvim_buf_get_name(bufnr)
|
||||
assert.are.same({
|
||||
buf = bufnr,
|
||||
filename = filename,
|
||||
dirname = vim.fs.dirname(filename),
|
||||
}, ctx)
|
||||
assert.equal(bufnr, ctx.buf)
|
||||
assert.equal(filename, ctx.filename)
|
||||
assert.equal(vim.fs.dirname(filename), ctx.dirname)
|
||||
end)
|
||||
|
||||
it("sets the shiftwidth to shiftwidth", function()
|
||||
vim.cmd.edit({ args = { "README.md" } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
vim.bo[bufnr].shiftwidth = 7
|
||||
conform.formatters.test = {
|
||||
meta = { url = "", description = "" },
|
||||
command = "echo",
|
||||
}
|
||||
local config = assert(conform.get_formatter_config("test"))
|
||||
local ctx = runner.build_context(0, config)
|
||||
assert.equal(7, ctx.shiftwidth)
|
||||
end)
|
||||
|
||||
it("sets the shiftwidth to tabstop as fallback", function()
|
||||
vim.cmd.edit({ args = { "README.md" } })
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
vim.bo[bufnr].shiftwidth = 0
|
||||
vim.bo[bufnr].tabstop = 3
|
||||
conform.formatters.test = {
|
||||
meta = { url = "", description = "" },
|
||||
command = "echo",
|
||||
}
|
||||
local config = assert(conform.get_formatter_config("test"))
|
||||
local ctx = runner.build_context(0, config)
|
||||
assert.equal(3, ctx.shiftwidth)
|
||||
end)
|
||||
|
||||
it("sets temp file when stdin = false", function()
|
||||
|
||||
Reference in New Issue
Block a user