aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_messages.vim21
-rw-r--r--src/nvim/testdir/test_registers.vim10
-rw-r--r--src/nvim/testdir/test_undo.vim14
-rw-r--r--test/functional/legacy/messages_spec.lua29
4 files changed, 66 insertions, 8 deletions
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim
index fb6c9c1554..5670368936 100644
--- a/src/nvim/testdir/test_messages.vim
+++ b/src/nvim/testdir/test_messages.vim
@@ -114,9 +114,7 @@ endfunc
" Test more-prompt (see :help more-prompt).
func Test_message_more()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot run vim in terminal'
- endif
+ CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
@@ -203,14 +201,22 @@ func Test_message_more()
call term_sendkeys(buf, 'q')
call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
- call term_sendkeys(buf, ":q!\n")
+ " Execute a : command from the more prompt
+ call term_sendkeys(buf, ":%p#\n")
+ call term_wait(buf)
+ call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
+ call term_sendkeys(buf, ":")
+ call term_wait(buf)
+ call WaitForAssert({-> assert_equal(':', term_getline(buf, 6))})
+ call term_sendkeys(buf, "echo 'Hello'\n")
+ call term_wait(buf)
+ call WaitForAssert({-> assert_equal('Hello ', term_getline(buf, 5))})
+
call StopVimInTerminal(buf)
endfunc
func Test_ask_yesno()
- if !CanRunVimInTerminal()
- throw 'Skipped: cannot run vim in terminal'
- endif
+ CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
@@ -233,7 +239,6 @@ func Test_ask_yesno()
call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
- call term_sendkeys(buf, ":q!\n")
call StopVimInTerminal(buf)
endfunc
diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim
index abe28b77cd..52e745438d 100644
--- a/src/nvim/testdir/test_registers.vim
+++ b/src/nvim/testdir/test_registers.vim
@@ -684,6 +684,16 @@ func Test_insert_small_delete()
bwipe!
endfunc
+" Record in insert mode using CTRL-O
+func Test_record_in_insert_mode()
+ new
+ let @r = ''
+ call setline(1, ['foo'])
+ call feedkeys("i\<C-O>qrbaz\<C-O>q", 'xt')
+ call assert_equal('baz', @r)
+ bwipe!
+endfunc
+
func Test_record_in_select_mode()
new
call setline(1, 'text')
diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim
index da8bf12318..efc39fb3f5 100644
--- a/src/nvim/testdir/test_undo.vim
+++ b/src/nvim/testdir/test_undo.vim
@@ -735,6 +735,20 @@ func Test_undofile_cryptmethod_blowfish2()
set undofile& undolevels& cryptmethod&
endfunc
+" Test for redoing with incrementing numbered registers
+func Test_redo_repeat_numbered_register()
+ new
+ for [i, v] in [[1, 'one'], [2, 'two'], [3, 'three'],
+ \ [4, 'four'], [5, 'five'], [6, 'six'],
+ \ [7, 'seven'], [8, 'eight'], [9, 'nine']]
+ exe 'let @' .. i .. '="' .. v .. '\n"'
+ endfor
+ call feedkeys('"1p.........', 'xt')
+ call assert_equal(['', 'one', 'two', 'three', 'four', 'five', 'six',
+ \ 'seven', 'eight', 'nine', 'nine'], getline(1, '$'))
+ bwipe!
+endfunc
+
func Test_undo_mark()
new
" The undo is applied to the only line.
diff --git a/test/functional/legacy/messages_spec.lua b/test/functional/legacy/messages_spec.lua
index 2b0e6941ef..b296ac909d 100644
--- a/test/functional/legacy/messages_spec.lua
+++ b/test/functional/legacy/messages_spec.lua
@@ -261,6 +261,35 @@ describe('messages', function()
^100 |
|
]])
+
+ -- Execute a : command from the more prompt
+ feed(':%p#\n')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ {1:-- More --}^ |
+ ]])
+ feed(':')
+ screen:expect([[
+ {2: 1 }1 |
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ :^ |
+ ]])
+ feed("echo 'Hello'\n")
+ screen:expect([[
+ {2: 2 }2 |
+ {2: 3 }3 |
+ {2: 4 }4 |
+ {2: 5 }5 |
+ Hello |
+ {1:Press ENTER or type command to continue}^ |
+ ]])
end)
-- oldtest: Test_quit_long_message()