diff options
Diffstat (limited to 'test/functional/lua/diagnostic_spec.lua')
-rw-r--r-- | test/functional/lua/diagnostic_spec.lua | 406 |
1 files changed, 330 insertions, 76 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua index 5802925339..05082bc132 100644 --- a/test/functional/lua/diagnostic_spec.lua +++ b/test/functional/lua/diagnostic_spec.lua @@ -1,13 +1,15 @@ -local helpers = require('test.functional.helpers')(after_each) +local t = require('test.testutil') +local n = require('test.functional.testnvim')() local NIL = vim.NIL -local command = helpers.command -local clear = helpers.clear -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local matches = helpers.matches -local api = helpers.api -local pcall_err = helpers.pcall_err +local command = n.command +local clear = n.clear +local exec_lua = n.exec_lua +local eq = t.eq +local matches = t.matches +local api = n.api +local pcall_err = t.pcall_err +local fn = n.fn describe('vim.diagnostic', function() before_each(function() @@ -16,12 +18,12 @@ describe('vim.diagnostic', function() exec_lua [[ require('vim.diagnostic') - function make_diagnostic(msg, x1, y1, x2, y2, severity, source, code) + function make_diagnostic(msg, lnum, col, end_lnum, end_col, severity, source, code) return { - lnum = x1, - col = y1, - end_lnum = x2, - end_col = y2, + lnum = lnum, + col = col, + end_lnum = end_lnum, + end_col = end_col, message = msg, severity = severity, source = source, @@ -29,20 +31,20 @@ describe('vim.diagnostic', function() } end - function make_error(msg, x1, y1, x2, y2, source, code) - return make_diagnostic(msg, x1, y1, x2, y2, vim.diagnostic.severity.ERROR, source, code) + function make_error(msg, lnum, col, end_lnum, end_col, source, code) + return make_diagnostic(msg, lnum, col, end_lnum, end_col, vim.diagnostic.severity.ERROR, source, code) end - function make_warning(msg, x1, y1, x2, y2, source, code) - return make_diagnostic(msg, x1, y1, x2, y2, vim.diagnostic.severity.WARN, source, code) + function make_warning(msg, lnum, col, end_lnum, end_col, source, code) + return make_diagnostic(msg, lnum, col, end_lnum, end_col, vim.diagnostic.severity.WARN, source, code) end - function make_info(msg, x1, y1, x2, y2, source, code) - return make_diagnostic(msg, x1, y1, x2, y2, vim.diagnostic.severity.INFO, source, code) + function make_info(msg, lnum, col, end_lnum, end_col, source, code) + return make_diagnostic(msg, lnum, col, end_lnum, end_col, vim.diagnostic.severity.INFO, source, code) end - function make_hint(msg, x1, y1, x2, y2, source, code) - return make_diagnostic(msg, x1, y1, x2, y2, vim.diagnostic.severity.HINT, source, code) + function make_hint(msg, lnum, col, end_lnum, end_col, source, code) + return make_diagnostic(msg, lnum, col, end_lnum, end_col, vim.diagnostic.severity.HINT, source, code) end function count_diagnostics(bufnr, severity, namespace) @@ -109,7 +111,7 @@ describe('vim.diagnostic', function() 'DiagnosticVirtualTextOk', 'DiagnosticVirtualTextWarn', 'DiagnosticWarn', - }, exec_lua([[return vim.fn.getcompletion('Diagnostic', 'highlight')]])) + }, fn.getcompletion('Diagnostic', 'highlight')) end) it('retrieves diagnostics from all buffers and namespaces', function() @@ -205,7 +207,7 @@ describe('vim.diagnostic', function() diag[1].col = 10000 return vim.diagnostic.get()[1].col == 10000 ]] - eq(result, false) + eq(false, result) end) it('resolves buffer number 0 to the current buffer', function() @@ -328,7 +330,7 @@ describe('vim.diagnostic', function() eq( { 1, 1, 2, 0, 2 }, exec_lua [[ - vim.diagnostic.disable(diagnostic_bufnr, diagnostic_ns) + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) return { count_diagnostics(diagnostic_bufnr, vim.diagnostic.severity.ERROR, diagnostic_ns), count_diagnostics(diagnostic_bufnr, vim.diagnostic.severity.WARN, other_ns), @@ -343,7 +345,7 @@ describe('vim.diagnostic', function() eq( all_highlights, exec_lua([[ - vim.diagnostic.enable(diagnostic_bufnr, diagnostic_ns) + vim.diagnostic.enable(true, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) return { count_diagnostics(diagnostic_bufnr, vim.diagnostic.severity.ERROR, diagnostic_ns), count_diagnostics(diagnostic_bufnr, vim.diagnostic.severity.WARN, other_ns), @@ -370,7 +372,7 @@ describe('vim.diagnostic', function() vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, ns_1_diags) vim.diagnostic.set(other_ns, diagnostic_bufnr, ns_2_diags) - vim.diagnostic.disable(diagnostic_bufnr, diagnostic_ns) + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) return { count_extmarks(diagnostic_bufnr, diagnostic_ns), @@ -382,8 +384,8 @@ describe('vim.diagnostic', function() eq( { 4, 0 }, exec_lua [[ - vim.diagnostic.enable(diagnostic_bufnr, diagnostic_ns) - vim.diagnostic.disable(diagnostic_bufnr, other_ns) + vim.diagnostic.enable(true, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr, ns_id = other_ns }) return { count_extmarks(diagnostic_bufnr, diagnostic_ns), @@ -477,7 +479,32 @@ describe('vim.diagnostic', function() end) describe('enable() and disable()', function() - it('works without arguments', function() + it('validation', function() + matches('expected boolean, got table', pcall_err(exec_lua, [[vim.diagnostic.enable({})]])) + matches( + 'filter: expected table, got string', + pcall_err(exec_lua, [[vim.diagnostic.enable(false, '')]]) + ) + matches( + 'Invalid buffer id: 42', + pcall_err(exec_lua, [[vim.diagnostic.enable(true, { bufnr = 42 })]]) + ) + matches( + 'expected boolean, got number', + pcall_err(exec_lua, [[vim.diagnostic.enable(42, {})]]) + ) + matches('expected boolean, got table', pcall_err(exec_lua, [[vim.diagnostic.enable({}, 42)]])) + + -- Deprecated signature. + matches('Invalid buffer id: 42', pcall_err(exec_lua, [[vim.diagnostic.enable(42)]])) + -- Deprecated signature. + matches( + 'namespace does not exist or is anonymous', + pcall_err(exec_lua, [[vim.diagnostic.enable(nil, 42)]]) + ) + end) + + it('without arguments', function() local result = exec_lua [[ vim.api.nvim_win_set_buf(0, diagnostic_bufnr) @@ -499,7 +526,7 @@ describe('vim.diagnostic', function() table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns)) - vim.diagnostic.disable() + vim.diagnostic.enable(false) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns)) @@ -531,7 +558,7 @@ describe('vim.diagnostic', function() eq(4, result[4]) end) - it('works with only a buffer argument', function() + it('with buffer argument', function() local result = exec_lua [[ local other_bufnr = vim.api.nvim_create_buf(true, false) @@ -560,19 +587,19 @@ describe('vim.diagnostic', function() count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - vim.diagnostic.disable(diagnostic_bufnr) + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr }) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - vim.diagnostic.enable(diagnostic_bufnr) + vim.diagnostic.enable(true, { bufnr = diagnostic_bufnr }) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - vim.diagnostic.disable(other_bufnr) + vim.diagnostic.enable(false, { bufnr = other_bufnr }) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + @@ -587,7 +614,7 @@ describe('vim.diagnostic', function() eq(3, result[4]) end) - it('works with only a namespace argument', function() + it('with a namespace argument', function() local result = exec_lua [[ vim.api.nvim_win_set_buf(0, diagnostic_bufnr) @@ -609,17 +636,17 @@ describe('vim.diagnostic', function() table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns)) - vim.diagnostic.disable(nil, diagnostic_ns) + vim.diagnostic.enable(false, { ns_id = diagnostic_ns }) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns)) - vim.diagnostic.enable(nil, diagnostic_ns) + vim.diagnostic.enable(true, { ns_id = diagnostic_ns }) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns)) - vim.diagnostic.disable(nil, other_ns) + vim.diagnostic.enable(false, { ns_id = other_ns }) table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns)) @@ -633,8 +660,11 @@ describe('vim.diagnostic', function() eq(2, result[4]) end) - it('works with both a buffer and a namespace argument', function() - local result = exec_lua [[ + --- @return table + local function test_enable(legacy) + local result = exec_lua( + [[ + local legacy = ... local other_bufnr = vim.api.nvim_create_buf(true, false) vim.api.nvim_win_set_buf(0, diagnostic_bufnr) @@ -662,34 +692,68 @@ describe('vim.diagnostic', function() count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - vim.diagnostic.disable(diagnostic_bufnr, diagnostic_ns) + if legacy then + vim.diagnostic.disable(diagnostic_bufnr, diagnostic_ns) + else + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) + end table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - vim.diagnostic.disable(diagnostic_bufnr, other_ns) + if legacy then + vim.diagnostic.disable(diagnostic_bufnr, other_ns) + else + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr, ns_id = other_ns }) + end table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - vim.diagnostic.enable(diagnostic_bufnr, diagnostic_ns) + if legacy then + vim.diagnostic.enable(diagnostic_bufnr, diagnostic_ns) + else + vim.diagnostic.enable(true, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) + end table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) - -- Should have no effect - vim.diagnostic.disable(other_bufnr, other_ns) + if legacy then + -- Should have no effect + vim.diagnostic.disable(other_bufnr, other_ns) + else + -- Should have no effect + vim.diagnostic.enable(false, { bufnr = other_bufnr, ns_id = other_ns }) + end table.insert(result, count_extmarks(diagnostic_bufnr, diagnostic_ns) + count_extmarks(diagnostic_bufnr, other_ns) + count_extmarks(other_bufnr, diagnostic_ns)) return result - ]] + ]], + legacy + ) + + return result + end + it('with both buffer and namespace arguments', function() + local result = test_enable(false) + eq(4, result[1]) + eq(2, result[2]) + eq(1, result[3]) + eq(3, result[4]) + eq(3, result[5]) + end) + + it('with both buffer and namespace arguments (deprecated signature)', function() + -- Exercise the legacy/deprecated signature. + local result = test_enable(true) eq(4, result[1]) eq(2, result[2]) eq(1, result[3]) @@ -870,15 +934,112 @@ describe('vim.diagnostic', function() eq( { 4, 0 }, exec_lua [[ - vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { - make_error('Diagnostic #1', 3, 9001, 3, 9001), - make_error('Diagnostic #2', 4, -1, 4, -1), - }) - vim.api.nvim_win_set_buf(0, diagnostic_bufnr) - vim.api.nvim_win_set_cursor(0, {1, 1}) - vim.diagnostic.goto_next { float = false } - return vim.diagnostic.get_next_pos { namespace = diagnostic_ns } - ]] + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_error('Diagnostic #1', 3, 9001, 3, 9001), + make_error('Diagnostic #2', 4, -1, 4, -1), + }) + vim.api.nvim_win_set_buf(0, diagnostic_bufnr) + vim.api.nvim_win_set_cursor(0, {1, 1}) + vim.diagnostic.goto_next { float = false } + return vim.diagnostic.get_next_pos { namespace = diagnostic_ns } + ]] + ) + end) + + it('jumps to diagnostic with highest severity', function() + exec_lua([[ + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_info('Info', 1, 0, 1, 1), + make_error('Error', 2, 0, 2, 1), + make_warning('Warning', 3, 0, 3, 1), + make_error('Error', 4, 0, 4, 1), + }) + + vim.api.nvim_win_set_buf(0, diagnostic_bufnr) + vim.api.nvim_win_set_cursor(0, {1, 0}) + ]]) + + eq( + { 3, 0 }, + exec_lua([[ + vim.diagnostic.goto_next({_highest = true}) + return vim.api.nvim_win_get_cursor(0) + ]]) + ) + + eq( + { 5, 0 }, + exec_lua([[ + vim.diagnostic.goto_next({_highest = true}) + return vim.api.nvim_win_get_cursor(0) + ]]) + ) + + exec_lua([[ + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_info('Info', 1, 0, 1, 1), + make_hint('Hint', 2, 0, 2, 1), + make_warning('Warning', 3, 0, 3, 1), + make_hint('Hint', 4, 0, 4, 1), + make_warning('Warning', 5, 0, 5, 1), + }) + + vim.api.nvim_win_set_buf(0, diagnostic_bufnr) + vim.api.nvim_win_set_cursor(0, {1, 0}) + ]]) + + eq( + { 4, 0 }, + exec_lua([[ + vim.diagnostic.goto_next({_highest = true}) + return vim.api.nvim_win_get_cursor(0) + ]]) + ) + + eq( + { 6, 0 }, + exec_lua([[ + vim.diagnostic.goto_next({_highest = true}) + return vim.api.nvim_win_get_cursor(0) + ]]) + ) + end) + + it('jumps to next diagnostic if severity is non-nil', function() + exec_lua([[ + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_info('Info', 1, 0, 1, 1), + make_error('Error', 2, 0, 2, 1), + make_warning('Warning', 3, 0, 3, 1), + make_error('Error', 4, 0, 4, 1), + }) + + vim.api.nvim_win_set_buf(0, diagnostic_bufnr) + vim.api.nvim_win_set_cursor(0, {1, 0}) + ]]) + + eq( + { 2, 0 }, + exec_lua([[ + vim.diagnostic.goto_next() + return vim.api.nvim_win_get_cursor(0) + ]]) + ) + + eq( + { 3, 0 }, + exec_lua([[ + vim.diagnostic.goto_next() + return vim.api.nvim_win_get_cursor(0) + ]]) + ) + + eq( + { 4, 0 }, + exec_lua([[ + vim.diagnostic.goto_next() + return vim.api.nvim_win_get_cursor(0) + ]]) ) end) end) @@ -940,6 +1101,29 @@ describe('vim.diagnostic', function() ]] ) end) + + it('works on blank line #28397', function() + eq( + { 0, 2 }, + exec_lua [[ + local test_bufnr = vim.api.nvim_create_buf(true, false) + vim.api.nvim_buf_set_lines(test_bufnr, 0, -1, false, { + 'first line', + '', + '', + 'end line', + }) + vim.diagnostic.set(diagnostic_ns, test_bufnr, { + make_info('Diagnostic #1', 0, 2, 0, 2), + make_info('Diagnostic #2', 2, 0, 2, 0), + make_info('Diagnostic #3', 2, 0, 2, 0), + }) + vim.api.nvim_win_set_buf(0, test_bufnr) + vim.api.nvim_win_set_cursor(0, {3, 0}) + return vim.diagnostic.get_prev_pos { namespace = diagnostic_ns} + ]] + ) + end) end) describe('get()', function() @@ -1013,13 +1197,13 @@ describe('vim.diagnostic', function() it('allows filtering by line', function() eq( - 1, + 2, exec_lua [[ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { make_error("Error 1", 1, 1, 1, 5), make_warning("Warning on Server 1", 1, 1, 2, 3), make_info("Ignored information", 1, 1, 2, 3), - make_error("Error On Other Line", 2, 1, 1, 5), + make_error("Error On Other Line", 3, 1, 3, 5), }) return #vim.diagnostic.get(diagnostic_bufnr, {lnum = 2}) @@ -1129,13 +1313,16 @@ describe('vim.diagnostic', function() it('allows filtering by line', function() eq( - exec_lua [[return { [vim.diagnostic.severity.ERROR] = 1 }]], + exec_lua [[return { + [vim.diagnostic.severity.WARN] = 1, + [vim.diagnostic.severity.INFO] = 1, + }]], exec_lua [[ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { make_error("Error 1", 1, 1, 1, 5), make_warning("Warning on Server 1", 1, 1, 2, 3), make_info("Ignored information", 1, 1, 2, 3), - make_error("Error On Other Line", 2, 1, 1, 5), + make_error("Error On Other Line", 3, 1, 3, 5), }) return vim.diagnostic.count(diagnostic_bufnr, {lnum = 2}) @@ -1554,7 +1741,7 @@ describe('vim.diagnostic', function() end) describe('set()', function() - it('validates its arguments', function() + it('validation', function() matches( 'expected a list of diagnostics', pcall_err(exec_lua, [[vim.diagnostic.set(1, 0, {lnum = 1, col = 2})]]) @@ -1741,7 +1928,7 @@ describe('vim.diagnostic', function() eq( 0, exec_lua [[ - vim.diagnostic.disable(diagnostic_bufnr, diagnostic_ns) + vim.diagnostic.enable(false, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { make_error('Diagnostic From Server 1:1', 1, 1, 1, 1), }) @@ -1752,7 +1939,7 @@ describe('vim.diagnostic', function() eq( 2, exec_lua [[ - vim.diagnostic.enable(diagnostic_bufnr, diagnostic_ns) + vim.diagnostic.enable(true, { bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }) return count_extmarks(diagnostic_bufnr, diagnostic_ns) ]] ) @@ -1825,20 +2012,12 @@ describe('vim.diagnostic', function() it('respects legacy signs placed with :sign define or sign_define #26618', function() -- Legacy signs for diagnostics were deprecated in 0.10 and will be removed in 0.12 - eq(0, helpers.fn.has('nvim-0.12')) + eq(0, n.fn.has('nvim-0.12')) - helpers.command( - 'sign define DiagnosticSignError text= texthl= linehl=ErrorMsg numhl=ErrorMsg' - ) - helpers.command( - 'sign define DiagnosticSignWarn text= texthl= linehl=WarningMsg numhl=WarningMsg' - ) - helpers.command( - 'sign define DiagnosticSignInfo text= texthl= linehl=Underlined numhl=Underlined' - ) - helpers.command( - 'sign define DiagnosticSignHint text= texthl= linehl=Underlined numhl=Underlined' - ) + n.command('sign define DiagnosticSignError text= texthl= linehl=ErrorMsg numhl=ErrorMsg') + n.command('sign define DiagnosticSignWarn text= texthl= linehl=WarningMsg numhl=WarningMsg') + n.command('sign define DiagnosticSignInfo text= texthl= linehl=Underlined numhl=Underlined') + n.command('sign define DiagnosticSignHint text= texthl= linehl=Underlined numhl=Underlined') local result = exec_lua [[ vim.diagnostic.config({ @@ -2451,6 +2630,47 @@ describe('vim.diagnostic', function() ]] ) end) + + it('works for multi-line diagnostics #21949', function() + -- open float failed non diagnostic lnum + eq( + vim.NIL, + exec_lua [[ + local diagnostics = { + make_error("Error in two lines lnum is 1 and end_lnum is 2", 1, 1, 2, 3), + } + local winids = {} + vim.api.nvim_win_set_buf(0, diagnostic_bufnr) + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, diagnostics) + local _, winnr = vim.diagnostic.open_float(0, { header = false }) + return winnr + ]] + ) + + -- can open a float window on lnum 1 + eq( + { '1. Error in two lines lnum is 1 and end_lnum is 2' }, + exec_lua [[ + vim.api.nvim_win_set_cursor(0, {2, 0}) + local float_bufnr, winnr = vim.diagnostic.open_float(0, { header = false }) + local lines = vim.api.nvim_buf_get_lines(float_bufnr, 0, -1, false) + vim.api.nvim_win_close(winnr, true) + return lines + ]] + ) + + -- can open a float window on end_lnum 2 + eq( + { '1. Error in two lines lnum is 1 and end_lnum is 2' }, + exec_lua [[ + vim.api.nvim_win_set_cursor(0, {3, 0}) + local float_bufnr, winnr = vim.diagnostic.open_float(0, { header = false }) + local lines = vim.api.nvim_buf_get_lines(float_bufnr, 0, -1, false) + vim.api.nvim_win_close(winnr, true) + return lines + ]] + ) + end) end) describe('setloclist()', function() @@ -2718,7 +2938,41 @@ describe('vim.diagnostic', function() ) end) - it('checks if diagnostics are disabled in a buffer', function() + it('is_enabled', function() + eq( + { false, false, false, false, false }, + exec_lua [[ + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_error('Diagnostic #1', 1, 1, 1, 1), + }) + vim.api.nvim_set_current_buf(diagnostic_bufnr) + vim.diagnostic.enable(false) + return { + vim.diagnostic.is_enabled(), + vim.diagnostic.is_enabled{ bufnr = 0 }, + vim.diagnostic.is_enabled{ bufnr = diagnostic_bufnr }, + vim.diagnostic.is_enabled{ bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }, + vim.diagnostic.is_enabled{ bufnr = 0, ns_id = diagnostic_ns }, + } + ]] + ) + + eq( + { true, true, true, true, true }, + exec_lua [[ + vim.diagnostic.enable() + return { + vim.diagnostic.is_enabled(), + vim.diagnostic.is_enabled{ bufnr = 0 }, + vim.diagnostic.is_enabled{ bufnr = diagnostic_bufnr }, + vim.diagnostic.is_enabled{ bufnr = diagnostic_bufnr, ns_id = diagnostic_ns }, + vim.diagnostic.is_enabled{ bufnr = 0, ns_id = diagnostic_ns }, + } + ]] + ) + end) + + it('is_disabled (deprecated)', function() eq( { true, true, true, true }, exec_lua [[ |