diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-03-09 13:38:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-09 13:38:32 -0700 |
commit | 25d3b92d071c77aec40f3e78d27537220fc68d70 (patch) | |
tree | 479b18b4e86c618300ab046f2f4813de36c4af0b /test | |
parent | d9585bdcfb5bc85c5a2f6fa5d211295c9c1011ea (diff) | |
parent | 124c655f56bcf31dfeaf91caee2e5f2fcbbfa089 (diff) | |
download | rneovim-25d3b92d071c77aec40f3e78d27537220fc68d70.tar.gz rneovim-25d3b92d071c77aec40f3e78d27537220fc68d70.tar.bz2 rneovim-25d3b92d071c77aec40f3e78d27537220fc68d70.zip |
Merge #32687 "g<" for ext_messages
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/ui/messages_spec.lua | 42 | ||||
-rw-r--r-- | test/unit/eval/decode_spec.lua | 4 | ||||
-rw-r--r-- | test/unit/eval/typval_spec.lua | 17 |
3 files changed, 52 insertions, 11 deletions
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 4770c5e143..a6577f3ca0 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -1571,6 +1571,48 @@ stack traceback: end, }) end) + + it('g< mapping shows recent messages', function() + command('echo "foo" | echo "bar"') + local s1 = [[ + ^ | + {1:~ }|*4 + ]] + screen:expect({ + grid = s1, + messages = { + { + content = { { 'bar' } }, + history = false, + kind = 'echo', + }, + }, + }) + feed(':messages<CR>g<lt>') + screen:expect({ + grid = [[ + ^ | + {1:~ }|*4 + ]], + messages = { + { + content = { { 'Press ENTER or type command to continue', 6, 18 } }, + history = false, + kind = 'return_prompt', + }, + }, + msg_history = { + { + content = { { 'foo' } }, + kind = 'echo', + }, + { + content = { { 'bar' } }, + kind = 'echo', + }, + }, + }) + end) end) describe('ui/builtin messages', function() diff --git a/test/unit/eval/decode_spec.lua b/test/unit/eval/decode_spec.lua index 7e037500b9..96e04dbbe5 100644 --- a/test/unit/eval/decode_spec.lua +++ b/test/unit/eval/decode_spec.lua @@ -70,8 +70,8 @@ describe('json_decode_string()', function() local rettv = ffi.new('typval_T', { v_type = decode.VAR_UNKNOWN }) eq(0, decode.json_decode_string(s, len, rettv)) eq(decode.VAR_UNKNOWN, rettv.v_type) - neq(nil, decode.last_msg_hist) - eq(msg, ffi.string(decode.last_msg_hist.msg)) + neq(nil, decode.msg_hist_last) + eq(msg, ffi.string(decode.msg_hist_last.msg.items[0].text.data)) end itp('does not overflow in error messages', function() diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua index 14fd7986e7..b4f115850b 100644 --- a/test/unit/eval/typval_spec.lua +++ b/test/unit/eval/typval_spec.lua @@ -101,20 +101,19 @@ local function ga_alloc(itemsize, growsize) end local function check_emsg(f, msg) - local saved_last_msg_hist = lib.last_msg_hist - if saved_last_msg_hist == nil then - saved_last_msg_hist = nil + local saved_msg_hist_last = lib.msg_hist_last + if saved_msg_hist_last == nil then + saved_msg_hist_last = nil end local ret = { f() } - local last_msg = lib.last_msg_hist ~= nil and ffi.string(lib.last_msg_hist.msg) or nil if msg ~= nil then - eq(msg, last_msg) - neq(saved_last_msg_hist, lib.last_msg_hist) + eq(msg, ffi.string(lib.msg_hist_last.msg.items[0].text.data)) + neq(saved_msg_hist_last, lib.msg_hist_last) else - if saved_last_msg_hist ~= lib.last_msg_hist then - eq(nil, last_msg) + if saved_msg_hist_last ~= lib.msg_hist_last then + eq(nil, lib.msg_hist_last) else - eq(saved_last_msg_hist, lib.last_msg_hist) + eq(saved_msg_hist_last, lib.msg_hist_last) end end return unpack(ret) |