diff options
author | mitchell <70453897+orbitalquark@users.noreply.github.com> | 2020-11-01 23:30:43 -0500 |
---|---|---|
committer | mitchell <70453897+orbitalquark@users.noreply.github.com> | 2020-11-01 23:30:43 -0500 |
commit | 85b8810660ffa37eb2d3edf85a4dbf12ba5f1ca3 (patch) | |
tree | c364b17b99c60326e7c85278c29ffc2c6584f598 /test/test.lua | |
parent | 2ec90788dc08346d74a79877a35f91c74d661688 (diff) |
Added optional mode parameter to `ui.command_entry.append_history()`.
This allows for arbitrary appending to history, not just for the current or
most recent mode.
Diffstat (limited to 'test/test.lua')
-rw-r--r-- | test/test.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test.lua b/test/test.lua index cc545257..53a7cb24 100644 --- a/test/test.lua +++ b/test/test.lua @@ -1413,7 +1413,16 @@ function test_command_entry_history_append() assert_equal(ui.command_entry:get_text(), 'bar') -- no further history events.emit(events.KEYPRESS, not CURSES and 0xFF0D or 343) -- \n - assert_raises(function() ui.command_entry:append_history('text') end, 'string expected, got table') + -- Verify no previous mode or history is needed for adding history. + local f2 = function() end + ui.command_entry.append_history(f2, 'baz') + ui.command_entry.run(f2, keys) + assert_equal(ui.command_entry:get_text(), 'baz') + events.emit(events.KEYPRESS, not CURSES and 0xFF0D or 343) -- \n + + assert_raises(function() ui.command_entry.append_history(1) end, 'string expected, got number') + assert_raises(function() ui.command_entry:append_history('text') end, 'function expected, got table') + assert_raises(function() ui.command_entry.append_history(function() end, true) end, 'string/nil expected, got boolean') end function test_command_entry_mode_restore() |