aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/setup.vim19
-rw-r--r--test/old/testdir/test_ex_mode.vim11
2 files changed, 28 insertions, 2 deletions
diff --git a/test/old/testdir/setup.vim b/test/old/testdir/setup.vim
index 2e4085ce03..6f400c5e32 100644
--- a/test/old/testdir/setup.vim
+++ b/test/old/testdir/setup.vim
@@ -32,8 +32,8 @@ if exists('s:did_load')
endif
if g:testname !~ 'test_mapping.vim$'
" Make "Q" switch to Ex mode.
- " This does not work for all tests.
- nnoremap Q gQ
+ " This does not work for all tests as Nvim only supports Vim Ex mode.
+ nnoremap Q gQ<Cmd>call<SID>ExStart()<CR>
endif
endif
@@ -45,6 +45,21 @@ if exists('s:did_load')
endif
let s:did_load = 1
+func s:ExStart()
+ call feedkeys($"\<Cmd>call{expand('<SID>')}ExMayEnd()\<CR>")
+endfunc
+
+func s:ExMayEnd()
+ " When :normal runs out of characters in Vim, the behavior is different in
+ " normal Ex mode vs. Vim Ex mode.
+ " - In normal Ex mode, "\n" is used.
+ " - In Vim Ex mode, Ctrl-C is used.
+ " Nvim only supports Vim Ex mode, so emulate the normal Ex mode behavior.
+ if state('m') == '' && mode(1) == 'cv' && getcharstr(1) == "\<C-C>"
+ call feedkeys("\n")
+ endif
+endfunc
+
" Clear Nvim default user commands, mappings and menus.
comclear
mapclear
diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim
index 42f08868a0..31615ec47d 100644
--- a/test/old/testdir/test_ex_mode.vim
+++ b/test/old/testdir/test_ex_mode.vim
@@ -282,4 +282,15 @@ func Test_ex_mode_large_indent()
endfunc
+" Testing implicit print command
+func Test_implicit_print()
+ new
+ call setline(1, ['one', 'two', 'three'])
+ call feedkeys('Q:let a=execute(":1,2")', 'xt')
+ call feedkeys('Q:let b=execute(":3")', 'xt')
+ call assert_equal('one two', a->split('\n')->join(' '))
+ call assert_equal('three', b->split('\n')->join(' '))
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab