diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index e0c9b0c..5ca4f34 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -361,6 +361,60 @@ test("ActionOutcome and DotPayload retain resolved result data", function() same("problem", domain.ActionOutcome.error(destination, "problem").diagnostic) end) +test("Host adapter restores exact cursor presentation values", function() + local options = { + guicursor = "n:block,i:ver37-blinkon123", + t_ve = "terminal-visible-sequence", + } + local writes = {} + local runtime = { + api = { + nvim_get_option_value = function(name, request) + same("global", request.scope) + return options[name] + end, + nvim_set_option_value = function(name, value, request) + same("global", request.scope) + options[name] = value + writes[#writes + 1] = { name = name, value = value } + end, + nvim_cmd = function(command) + same("let", command.cmd) + same("&t_ve", command.args[1]) + same("=", command.args[2]) + options.t_ve = command.args[3] + writes[#writes + 1] = { name = "t_ve", value = command.args[3] } + end, + }, + fn = { + exists = function(name) + same("+t_ve", name) + return 1 + end, + eval = function(name) + same("&t_ve", name) + return options.t_ve + end, + string = function(value) + return value + end, + }, + } + local adapter = host_adapter.new({ runtime = runtime }) + truthy(adapter:supports_cursor_presentation()) + + local lease = adapter:suppress_cursor_presentation() + truthy(lease ~= nil) + same("a:ver1", options.guicursor) + same("", options.t_ve) + + truthy(adapter:restore_cursor_presentation(lease)) + same("n:block,i:ver37-blinkon123", options.guicursor) + same("terminal-visible-sequence", options.t_ve) + falsy(adapter:restore_cursor_presentation(lease)) + same(4, #writes) +end) + test("Host adapter owns Nvim timers and event registrations", function() local timer_callbacks = {} local stopped_timers = {} |
