Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoshihou514 committed Aug 31, 2024
1 parent ab8b49d commit 2a7e38c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions spec/settings_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ describe('settings', function()
end)

it('can override save_on_fmt before setting up formatter', function()
same(true, util.getopt('fmt_on_save'))
same(true, util.getopt('save_on_fmt'))
vim.g.guard_config = { save_on_fmt = false }
same(false, util.getopt('fmt_on_save'))
same(false, util.getopt('save_on_fmt'))

ft('lua'):fmt({
cmd = 'stylua',
Expand Down Expand Up @@ -116,13 +116,10 @@ describe('settings', function()
same(false, util.getopt('save_on_fmt'))
api.nvim_buf_set_lines(bufnr, 0, -1, false, {
'local a',
' =42',
' =42',
})
vim.cmd('Guard fmt')
vim.wait(500)
same({
'local a = 42',
}, api.nvim_buf_get_lines(bufnr, 0, -1, false))
same(true, vim.bo.modified)
end)
end)

0 comments on commit 2a7e38c

Please sign in to comment.