diff options
author | Matthew Toohey <contact@mtoohey.com> | 2021-12-05 21:39:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-05 19:39:00 -0700 |
commit | 62f0157853c0363d47466d06c6548dbd96d9b39c (patch) | |
tree | 673b0ee9f18eac50b8fd3b7bd5391b9ef4aa83d1 /test/functional/lua/diagnostic_spec.lua | |
parent | 24f9463dd07abc5953e01d3a5ca52b734544b471 (diff) | |
download | rneovim-62f0157853c0363d47466d06c6548dbd96d9b39c.tar.gz rneovim-62f0157853c0363d47466d06c6548dbd96d9b39c.tar.bz2 rneovim-62f0157853c0363d47466d06c6548dbd96d9b39c.zip |
fix(diagnostic): escape special chars in file names (#16527)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat (limited to 'test/functional/lua/diagnostic_spec.lua')
-rw-r--r-- | test/functional/lua/diagnostic_spec.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua index 927ee8060d..eeb9316b06 100644 --- a/test/functional/lua/diagnostic_spec.lua +++ b/test/functional/lua/diagnostic_spec.lua @@ -1918,5 +1918,27 @@ describe('vim.diagnostic', function() return {show_called, hide_called} ]]) end) + + it('triggers the autocommand when diagnostics are set', function() + eq(1, exec_lua [[ + vim.g.diagnostic_autocmd_triggered = 0 + vim.cmd('autocmd DiagnosticChanged * let g:diagnostic_autocmd_triggered = 1') + vim.api.nvim_buf_set_name(diagnostic_bufnr, "test | test") + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_error('Diagnostic', 0, 0, 0, 0) + }) + return vim.g.diagnostic_autocmd_triggered + ]]) + end) + + it('triggers the autocommand when diagnostics are cleared', function() + eq(1, exec_lua [[ + vim.g.diagnostic_autocmd_triggered = 0 + vim.cmd('autocmd DiagnosticChanged * let g:diagnostic_autocmd_triggered = 1') + vim.api.nvim_buf_set_name(diagnostic_bufnr, "test | test") + vim.diagnostic.reset(diagnostic_ns, diagnostic_bufnr) + return vim.g.diagnostic_autocmd_triggered + ]]) + end) end) end) |