diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2018-07-23 02:10:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-23 02:10:06 +0200 |
| commit | 48c0e916a1224200eb95e08c2899b7b891dd53dc (patch) | |
| tree | e4a6996204f58e9c83c6c41af228ac5616e652b7 /src/nvim/testdir | |
| parent | c9f2faf3bf3402690b6c9070e15a479df09a01da (diff) | |
| parent | 031d21221eb430aba70ccee140082a4b39e7192d (diff) | |
| download | rneovim-48c0e916a1224200eb95e08c2899b7b891dd53dc.tar.gz rneovim-48c0e916a1224200eb95e08c2899b7b891dd53dc.tar.bz2 rneovim-48c0e916a1224200eb95e08c2899b7b891dd53dc.zip | |
Merge #8753 from janlazo/vim-8.0.0724
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/Makefile | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test_registers.vim | 65 |
2 files changed, 66 insertions, 0 deletions
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index e3b717989e..87d7ff5bad 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -93,6 +93,7 @@ NEW_TESTS ?= \ test_quickfix.res \ test_quotestar.res \ test_recover.res \ + test_registers.res \ test_retab.res \ test_scrollbind.res \ test_search.res \ diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim new file mode 100644 index 0000000000..d7b6de5652 --- /dev/null +++ b/src/nvim/testdir/test_registers.vim @@ -0,0 +1,65 @@ + +func Test_yank_shows_register() + enew + set report=0 + call setline(1, ['foo', 'bar']) + " Line-wise + exe 'norm! yy' + call assert_equal('1 line yanked', v:statusmsg) + exe 'norm! "zyy' + call assert_equal('1 line yanked into "z', v:statusmsg) + exe 'norm! yj' + call assert_equal('2 lines yanked', v:statusmsg) + exe 'norm! "zyj' + call assert_equal('2 lines yanked into "z', v:statusmsg) + + " Block-wise + exe "norm! \<C-V>y" + call assert_equal('block of 1 line yanked', v:statusmsg) + exe "norm! \<C-V>\"zy" + call assert_equal('block of 1 line yanked into "z', v:statusmsg) + exe "norm! \<C-V>jy" + call assert_equal('block of 2 lines yanked', v:statusmsg) + exe "norm! \<C-V>j\"zy" + call assert_equal('block of 2 lines yanked into "z', v:statusmsg) + + bwipe! +endfunc + +func Test_display_registers() + e file1 + e file2 + call setline(1, ['foo', 'bar']) + /bar + exe 'norm! y2l"axx' + call feedkeys("i\<C-R>=2*4\n\<esc>") + call feedkeys(":ls\n", 'xt') + + let a = execute('display') + let b = execute('registers') + + call assert_equal(a, b) + call assert_match('^\n--- Registers ---\n' + \ . '"" a\n' + \ . '"0 ba\n' + \ . '"1 b\n' + \ . '"a b\n' + \ . '.*' + \ . '"- a\n' + \ . '.*' + \ . '": ls\n' + \ . '"% file2\n' + \ . '"# file1\n' + \ . '"/ bar\n' + \ . '"= 2\*4', a) + + let a = execute('registers a') + call assert_match('^\n--- Registers ---\n' + \ . '"a b', a) + + let a = execute('registers :') + call assert_match('^\n--- Registers ---\n' + \ . '": ls', a) + + bwipe! +endfunc |