summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-17 21:33:30 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-17 21:33:30 +0100
commitbc2b71d44a0b90b6aeb3534a76912fccbe5577df (patch)
treea77a42312e3d84710013ca0ba0f919ab79867560
parentb13af50f73dd89503c915f76fcf92be58789521a (diff)
downloadvim-git-bc2b71d44a0b90b6aeb3534a76912fccbe5577df.tar.gz
patch 8.2.0270: some code not covered by testsv8.2.0270
Problem: Some code not covered by tests. Solution: Add test cases. (Yegappan Lakshmanan, closes #5649)
-rw-r--r--src/testdir/test_autocmd.vim2
-rw-r--r--src/testdir/test_buffer.vim4
-rw-r--r--src/testdir/test_edit.vim18
-rw-r--r--src/testdir/test_ex_mode.vim7
-rw-r--r--src/testdir/test_excmd.vim56
-rw-r--r--src/testdir/test_expand.vim29
-rw-r--r--src/testdir/test_filetype.vim22
-rw-r--r--src/testdir/test_findfile.vim40
-rw-r--r--src/testdir/test_join.vim6
-rw-r--r--src/testdir/test_move.vim1
-rw-r--r--src/testdir/test_normal.vim2
-rw-r--r--src/testdir/test_registers.vim11
-rw-r--r--src/testdir/test_source.vim21
-rw-r--r--src/testdir/test_tabpage.vim14
-rw-r--r--src/testdir/test_tagjump.vim201
-rw-r--r--src/testdir/test_vimscript.vim10
-rw-r--r--src/testdir/test_visual.vim14
-rw-r--r--src/testdir/test_window_cmd.vim9
-rw-r--r--src/testdir/test_writefile.vim4
-rw-r--r--src/version.c2
20 files changed, 466 insertions, 7 deletions
diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim
index 23deec6c3..3b071049c 100644
--- a/src/testdir/test_autocmd.vim
+++ b/src/testdir/test_autocmd.vim
@@ -2357,3 +2357,5 @@ func Test_FileType_spell()
au! crash
setglobal spellfile=
endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_buffer.vim b/src/testdir/test_buffer.vim
index f2feca9fa..3266adc27 100644
--- a/src/testdir/test_buffer.vim
+++ b/src/testdir/test_buffer.vim
@@ -103,9 +103,9 @@ func Test_buflist_browse()
call assert_equal(b2, bufnr())
call assert_equal(1, line('.'))
- brewind +/foo3
+ brewind +
call assert_equal(b1, bufnr())
- call assert_equal(3, line('.'))
+ call assert_equal(4, line('.'))
blast +/baz2
call assert_equal(b3, bufnr())
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 1a37146ce..eef22d49c 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -1500,6 +1500,22 @@ func Test_edit_startinsert()
bwipe!
endfunc
+" Test for :startreplace and :startgreplace
+func Test_edit_startreplace()
+ new
+ call setline(1, 'abc')
+ call feedkeys("l:startreplace\<CR>xyz\e", 'xt')
+ call assert_equal('axyz', getline(1))
+ call feedkeys("0:startreplace!\<CR>abc\e", 'xt')
+ call assert_equal('axyzabc', getline(1))
+ call setline(1, "a\tb")
+ call feedkeys("0l:startgreplace\<CR>xyz\e", 'xt')
+ call assert_equal("axyz\tb", getline(1))
+ call feedkeys("0i\<C-R>=execute('startreplace')\<CR>12\e", 'xt')
+ call assert_equal("12axyz\tb", getline(1))
+ close!
+endfunc
+
func Test_edit_noesckeys()
CheckNotGui
new
@@ -1519,3 +1535,5 @@ func Test_edit_noesckeys()
bwipe!
set esckeys
endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_ex_mode.vim b/src/testdir/test_ex_mode.vim
index 7861477c7..bf1010498 100644
--- a/src/testdir/test_ex_mode.vim
+++ b/src/testdir/test_ex_mode.vim
@@ -55,7 +55,7 @@ func Test_ex_mode()
let &encoding = encoding_save
endfunc
-" Test subsittute confirmation prompt :%s/pat/str/c in Ex mode
+" Test substitute confirmation prompt :%s/pat/str/c in Ex mode
func Test_Ex_substitute()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
@@ -77,6 +77,11 @@ func Test_Ex_substitute()
call term_sendkeys(buf, "q\<CR>")
call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000)
+ " Pressing enter in ex mode should print the current line
+ call term_sendkeys(buf, "\<CR>")
+ call WaitForAssert({-> assert_match(' 3 foo foo',
+ \ term_getline(buf, 5))}, 1000)
+
call term_sendkeys(buf, ":vi\<CR>")
call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000)
diff --git a/src/testdir/test_excmd.vim b/src/testdir/test_excmd.vim
index 7ce32ca42..2407f8eb1 100644
--- a/src/testdir/test_excmd.vim
+++ b/src/testdir/test_excmd.vim
@@ -267,6 +267,16 @@ func Test_redir_cmd()
call assert_fails('redir! > Xfile', 'E190:')
call delete('Xfile')
endif
+
+ " Test for redirecting to a register
+ redir @q> | echon 'clean ' | redir END
+ redir @q>> | echon 'water' | redir END
+ call assert_equal('clean water', @q)
+
+ " Test for redirecting to a variable
+ redir => color | echon 'blue ' | redir END
+ redir =>> color | echon 'sky' | redir END
+ call assert_equal('blue sky', color)
endfunc
" Test for the :filetype command
@@ -279,4 +289,50 @@ func Test_mode_cmd()
call assert_fails('mode abc', 'E359:')
endfunc
+" Test for the :sleep command
+func Test_sleep_cmd()
+ call assert_fails('sleep x', 'E475:')
+endfunc
+
+" Test for the :read command
+func Test_read_cmd()
+ call writefile(['one'], 'Xfile')
+ new
+ call assert_fails('read', 'E32:')
+ edit Xfile
+ read
+ call assert_equal(['one', 'one'], getline(1, '$'))
+ close!
+ new
+ read Xfile
+ call assert_equal(['', 'one'], getline(1, '$'))
+ call deletebufline('', 1, '$')
+ call feedkeys("Qr Xfile\<CR>visual\<CR>", 'xt')
+ call assert_equal(['one'], getline(1, '$'))
+ close!
+ call delete('Xfile')
+endfunc
+
+" Test for running Ex commands when text is locked.
+" <C-\>e in the command line is used to lock the text
+func Test_run_excmd_with_text_locked()
+ " :quit
+ let cmd = ":\<C-\>eexecute('quit')\<CR>\<C-C>"
+ call assert_fails("call feedkeys(cmd, 'xt')", 'E523:')
+
+ " :qall
+ let cmd = ":\<C-\>eexecute('qall')\<CR>\<C-C>"
+ call assert_fails("call feedkeys(cmd, 'xt')", 'E523:')
+
+ " :exit
+ let cmd = ":\<C-\>eexecute('exit')\<CR>\<C-C>"
+ call assert_fails("call feedkeys(cmd, 'xt')", 'E523:')
+
+ " :close - should be ignored
+ new
+ let cmd = ":\<C-\>eexecute('close')\<CR>\<C-C>"
+ call assert_equal(2, winnr('$'))
+ close
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim
index 48dce25bb..5a5190371 100644
--- a/src/testdir/test_expand.vim
+++ b/src/testdir/test_expand.vim
@@ -1,5 +1,7 @@
" Test for expanding file names
+source shared.vim
+
func Test_with_directories()
call mkdir('Xdir1')
call mkdir('Xdir2')
@@ -81,3 +83,30 @@ func Test_expandcmd()
call assert_fails('call expandcmd("make %")', 'E499:')
close
endfunc
+
+" Test for expanding <sfile>, <slnum> and <sflnum> outside of sourcing a script
+func Test_source_sfile()
+ let lines =<< trim [SCRIPT]
+ :call assert_fails('echo expandcmd("<sfile>")', 'E498:')
+ :call assert_fails('echo expandcmd("<slnum>")', 'E842:')
+ :call assert_fails('echo expandcmd("<sflnum>")', 'E961:')
+ :call assert_fails('call expandcmd("edit <cfile>")', 'E446:')
+ :call assert_fails('call expandcmd("edit #")', 'E194:')
+ :call assert_fails('call expandcmd("edit #<2")', 'E684:')
+ :call assert_fails('call expandcmd("edit <cword>")', 'E348:')
+ :call assert_fails('call expandcmd("edit <cexpr>")', 'E348:')
+ :call assert_fails('autocmd User MyCmd echo "<sfile>"', 'E498:')
+ :call writefile(v:errors, 'Xresult')
+ :qall!
+
+ [SCRIPT]
+ call writefile(lines, 'Xscript')
+ if RunVim([], [], '--clean -s Xscript')
+ call assert_equal([], readfile('Xresult'))
+ endif
+ call delete('Xscript')
+ call delete('Xresult')
+endfunc
+
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index 3868e73c5..213f2de1c 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -621,3 +621,25 @@ func Test_setfiletype_completion()
call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"setfiletype java javacc javascript javascriptreact', @:)
endfunc
+
+" Test for ':filetype detect' command for a buffer without a file
+func Test_emptybuf_ftdetect()
+ new
+ call setline(1, '#!/bin/sh')
+ call assert_equal('', &filetype)
+ filetype detect
+ call assert_equal('sh', &filetype)
+ close!
+endfunc
+
+" Test for ':filetype indent on' and ':filetype indent off' commands
+func Test_filetype_indent_off()
+ new Xtest.vim
+ filetype indent on
+ call assert_equal(1, g:did_indent_on)
+ filetype indent off
+ call assert_equal(0, exists('g:did_indent_on'))
+ close
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_findfile.vim b/src/testdir/test_findfile.vim
index 2e6f88889..ac6d8637b 100644
--- a/src/testdir/test_findfile.vim
+++ b/src/testdir/test_findfile.vim
@@ -183,3 +183,43 @@ func Test_finddir_error()
call assert_fails('call finddir("x", "**x")', 'E343:')
call assert_fails('call finddir("x", repeat("x", 5000))', 'E854:')
endfunc
+
+" Test for the :find, :sfind and :tabfind commands
+func Test_find_cmd()
+ new
+ let save_path = &path
+ let save_dir = getcwd()
+ set path=.,./**/*
+ call CreateFiles()
+ cd Xdir1
+
+ " Test for :find
+ find foo
+ call assert_equal('foo', expand('%:.'))
+ 2find foo
+ call assert_equal('Xdir2/foo', expand('%:.'))
+ call assert_fails('3find foo', 'E347:')
+
+ " Test for :sfind
+ enew
+ sfind barfoo
+ call assert_equal('Xdir2/Xdir3/barfoo', expand('%:.'))
+ call assert_equal(3, winnr('$'))
+ close
+ call assert_fails('sfind baz', 'E345:')
+ call assert_equal(2, winnr('$'))
+
+ " Test for :tabfind
+ enew
+ tabfind foobar
+ call assert_equal('Xdir2/foobar', expand('%:.'))
+ call assert_equal(2, tabpagenr('$'))
+ tabclose
+ call assert_fails('tabfind baz', 'E345:')
+ call assert_equal(1, tabpagenr('$'))
+
+ call chdir(save_dir)
+ call CleanFiles()
+ let &path = save_path
+ close
+endfunc
diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim
index 377edab1e..fdd9e05eb 100644
--- a/src/testdir/test_join.vim
+++ b/src/testdir/test_join.vim
@@ -436,5 +436,11 @@ func Test_join_lines()
call setline(1, ['a', 'b', '', 'c', 'd'])
normal 5J
call assert_equal('a b c d', getline(1))
+ call setline(1, ['a', 'b', 'c'])
+ 2,2join
+ call assert_equal(['a', 'b', 'c'], getline(1, '$'))
+ call assert_equal(2, line('.'))
+ 2join
+ call assert_equal(['a', 'b c'], getline(1, '$'))
bwipe!
endfunc
diff --git a/src/testdir/test_move.vim b/src/testdir/test_move.vim
index f666a904b..8c40369db 100644
--- a/src/testdir/test_move.vim
+++ b/src/testdir/test_move.vim
@@ -38,6 +38,7 @@ func Test_move()
call assert_fails("move -100", 'E16:')
call assert_fails("move +100", 'E16:')
call assert_fails('move', 'E16:')
+ call assert_fails("move 'r", 'E20:')
%bwipeout!
endfunc
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 2115c76dd..843374d26 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -2006,7 +2006,7 @@ fun! Test_normal37_g_cmd6()
tabclose
endfor
" clean up
- call assert_fails(':tabclose', 'E784')
+ call assert_fails(':tabclose', 'E784:')
endfunc
fun! Test_normal38_nvhome()
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index 45cf02a59..b8f0a1012 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -386,4 +386,15 @@ func Test_put_reg_restart_mode()
bwipe!
endfunc
+" Test for executing a register using :@ command
+func Test_execute_register()
+ call setreg('r', [])
+ call assert_beeps('@r')
+ let i = 1
+ let @q = 'let i+= 1'
+ @q
+ @
+ call assert_equal(3, i)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_source.vim b/src/testdir/test_source.vim
index e7f3fb188..ba6fd5ad9 100644
--- a/src/testdir/test_source.vim
+++ b/src/testdir/test_source.vim
@@ -66,4 +66,25 @@ func Test_source_ignore_shebang()
call delete('Xfile.vim')
endfunc
+" Test for expanding <sfile> in a autocmd and for <slnum> and <sflnum>
+func Test_source_autocmd_sfile()
+ let code =<< trim [CODE]
+ let g:SfileName = ''
+ augroup sfiletest
+ au!
+ autocmd User UserAutoCmd let g:Sfile = '<sfile>:t'
+ augroup END
+ doautocmd User UserAutoCmd
+ let g:Slnum = expand('<slnum>')
+ let g:Sflnum = expand('<sflnum>')
+ augroup! sfiletest
+ [CODE]
+ call writefile(code, 'Xscript.vim')
+ source Xscript.vim
+ call assert_equal('Xscript.vim', g:Sfile)
+ call assert_equal('7', g:Slnum)
+ call assert_equal('8', g:Sflnum)
+ call delete('Xscript.vim')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim
index bf721a0b6..35c9fd0ea 100644
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -139,7 +139,11 @@ function Test_tabpage()
call assert_fails("tabmove -99", 'E474:')
call assert_fails("tabmove -3+", 'E474:')
call assert_fails("tabmove $3", 'E474:')
+ call assert_fails("%tabonly", 'E16:')
1tabonly!
+ tabnew
+ call assert_fails("-2tabmove", 'E474:')
+ tabonly!
endfunc
" Test autocommands
@@ -609,4 +613,14 @@ func Test_tabpage_cmdheight()
call delete('XTest_tabpage_cmdheight')
endfunc
+" Test for closing the tab page from a command window
+func Test_tabpage_close_cmdwin()
+ tabnew
+ call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt')
+ call assert_equal(2, tabpagenr('$'))
+ call feedkeys("q/:tabonly\<CR>\<Esc>", 'xt')
+ call assert_equal(2, tabpagenr('$'))
+ tabonly
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 47b9ffb45..29c384059 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -893,6 +893,11 @@ func Test_tag_multimatch()
tag FIRST
tnext
call assert_equal(2, line('.'))
+ tlast
+ tprev
+ call assert_equal(2, line('.'))
+ tNext
+ call assert_equal(1, line('.'))
set ignorecase&
call delete('Xtags')
@@ -1035,4 +1040,200 @@ Type number and <Enter> (empty cancels):
%bwipe
endfunc
+" Test for :isearch, :ilist, :ijump and :isplit commands
+" Test for [i, ]i, [I, ]I, [ CTRL-I, ] CTRL-I and CTRL-W i commands
+func Test_inc_search()
+ new
+ call setline(1, ['1:foo', '2:foo', 'foo', '3:foo', '4:foo'])
+ call cursor(3, 1)
+
+ " Test for [i and ]i
+ call assert_equal('1:foo', execute('normal [i'))
+ call assert_equal('2:foo', execute('normal 2[i'))
+ call assert_fails('normal 3[i', 'E387:')
+ call assert_equal('3:foo', execute('normal ]i'))
+ call assert_equal('4:foo', execute('normal 2]i'))
+ call assert_fails('normal 3]i', 'E389:')
+
+ " Test for :isearch
+ call assert_equal('1:foo', execute('isearch foo'))
+ call assert_equal('3:foo', execute('isearch 4 /foo/'))
+ call assert_fails('isearch 3 foo', 'E387:')
+ call assert_equal('3:foo', execute('+1,$isearch foo'))
+ call assert_fails('1,.-1isearch 3 foo', 'E389:')
+ call assert_fails('isearch bar', 'E389:')
+ call assert_fails('isearch /foo/3', 'E488:')
+
+ " Test for [I and ]I
+ call assert_equal([
+ \ ' 1: 1 1:foo',
+ \ ' 2: 2 2:foo',
+ \ ' 3: 3 foo',
+ \ ' 4: 4 3:foo',
+ \ ' 5: 5 4:foo'], split(execute('normal [I'), "\n"))
+ call assert_equal([
+ \ ' 1: 4 3:foo',
+ \ ' 2: 5 4:foo'], split(execute('normal ]I'), "\n"))
+
+ " Test for :ilist
+ call assert_equal([
+ \ ' 1: 1 1:foo',
+ \ ' 2: 2 2:foo',
+ \ ' 3: 3 foo',
+ \ ' 4: 4 3:foo',
+ \ ' 5: 5 4:foo'], split(execute('ilist foo'), "\n"))
+ call assert_equal([
+ \ ' 1: 4 3:foo',
+ \ ' 2: 5 4:foo'], split(execute('+1,$ilist /foo/'), "\n"))
+ call assert_fails('ilist bar', 'E389:')
+
+ " Test for [ CTRL-I and ] CTRL-I
+ exe "normal [\t"
+ call assert_equal([1, 3], [line('.'), col('.')])
+ exe "normal 2j4[\t"
+ call assert_equal([4, 3], [line('.'), col('.')])
+ call assert_fails("normal k3[\t", 'E387:')
+ call assert_fails("normal 6[\t", 'E389:')
+ exe "normal ]\t"
+ call assert_equal([4, 3], [line('.'), col('.')])
+ exe "normal k2]\t"
+ call assert_equal([5, 3], [line('.'), col('.')])
+ call assert_fails("normal 2k3]\t", 'E389:')
+
+ " Test for :ijump
+ call cursor(3, 1)
+ ijump foo
+ call assert_equal([1, 3], [line('.'), col('.')])
+ call cursor(3, 1)
+ ijump 4 /foo/
+ call assert_equal([4, 3], [line('.'), col('.')])
+ call cursor(3, 1)
+ call assert_fails('ijump 3 foo', 'E387:')
+ +,$ijump 2 foo
+ call assert_equal([5, 3], [line('.'), col('.')])
+ call assert_fails('ijump bar', 'E389:')
+
+ " Test for CTRL-W i
+ call cursor(3, 1)
+ wincmd i
+ call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
+ close
+ 5wincmd i
+ call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
+ close
+ call assert_fails('3wincmd i', 'E387:')
+ call assert_fails('6wincmd i', 'E389:')
+
+ " Test for :isplit
+ isplit foo
+ call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
+ close
+ isplit 5 /foo/
+ call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
+ close
+ call assert_fails('isplit 3 foo', 'E387:')
+ call assert_fails('isplit 6 foo', 'E389:')
+ call assert_fails('isplit bar', 'E389:')
+
+ close!
+endfunc
+
+" Test for :dsearch, :dlist, :djump and :dsplit commands
+" Test for [d, ]d, [D, ]D, [ CTRL-D, ] CTRL-D and CTRL-W d commands
+func Test_def_search()
+ new
+ call setline(1, ['#define FOO 1', '#define FOO 2', '#define FOO 3',
+ \ '#define FOO 4', '#define FOO 5'])
+ call cursor(3, 9)
+
+ " Test for [d and ]d
+ call assert_equal('#define FOO 1', execute('normal [d'))
+ call assert_equal('#define FOO 2', execute('normal 2[d'))
+ call assert_fails('normal 3[d', 'E387:')
+ call assert_equal('#define FOO 4', execute('normal ]d'))
+ call assert_equal('#define FOO 5', execute('normal 2]d'))
+ call assert_fails('normal 3]d', 'E388:')
+
+ " Test for :dsearch
+ call assert_equal('#define FOO 1', execute('dsearch FOO'))
+ call assert_equal('#define FOO 5', execute('dsearch 5 /FOO/'))
+ call assert_fails('dsearch 3 FOO', 'E387:')
+ call assert_equal('#define FOO 4', execute('+1,$dsearch FOO'))
+ call assert_fails('1,.-1dsearch 3 FOO', 'E388:')
+ call assert_fails('dsearch BAR', 'E388:')
+
+ " Test for [D and ]D
+ call assert_equal([
+ \ ' 1: 1 #define FOO 1',
+ \ ' 2: 2 #define FOO 2',
+ \ ' 3: 3 #define FOO 3',
+ \ ' 4: 4 #define FOO 4',
+ \ ' 5: 5 #define FOO 5'], split(execute('normal [D'), "\n"))
+ call assert_equal([
+ \ ' 1: 4 #define FOO 4',
+ \ ' 2: 5 #define FOO 5'], split(execute('normal ]D'), "\n"))
+
+ " Test for :dlist
+ call assert_equal([
+ \ ' 1: 1 #define FOO 1',
+ \ ' 2: 2 #define FOO 2',
+ \ ' 3: 3 #define FOO 3',
+ \ ' 4: 4 #define FOO 4',
+ \ ' 5: 5 #define FOO 5'], split(execute('dlist FOO'), "\n"))
+ call assert_equal([
+ \ ' 1: 4 #define FOO 4',
+ \ ' 2: 5 #define FOO 5'], split(execute('+1,$dlist /FOO/'), "\n"))
+ call assert_fails('dlist BAR', 'E388:')
+
+ " Test for [ CTRL-D and ] CTRL-D
+ exe "normal [\<C-D>"
+ call assert_equal([1, 9], [line('.'), col('.')])
+ exe "normal 2j4[\<C-D>"
+ call assert_equal([4, 9], [line('.'), col('.')])
+ call assert_fails("normal k3[\<C-D>", 'E387:')
+ call assert_fails("normal 6[\<C-D>", 'E388:')
+ exe "normal ]\<C-D>"
+ call assert_equal([4, 9], [line('.'), col('.')])
+ exe "normal k2]\<C-D>"
+ call assert_equal([5, 9], [line('.'), col('.')])
+ call assert_fails("normal 2k3]\<C-D>", 'E388:')
+
+ " Test for :djump
+ call cursor(3, 9)
+ djump FOO
+ call assert_equal([1, 9], [line('.'), col('.')])
+ call cursor(3, 9)
+ djump 4 /FOO/
+ call assert_equal([4, 9], [line('.'), col('.')])
+ call cursor(3, 9)
+ call assert_fails('djump 3 FOO', 'E387:')
+ +,$djump 2 FOO
+ call assert_equal([5, 9], [line('.'), col('.')])
+ call assert_fails('djump BAR', 'E388:')
+
+ " Test for CTRL-W d
+ call cursor(3, 9)
+ wincmd d
+ call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
+ close
+ 5wincmd d
+ call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
+ close
+ call assert_fails('3wincmd d', 'E387:')
+ call assert_fails('6wincmd d', 'E388:')
+
+ " Test for :dsplit
+ dsplit FOO
+ call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
+ close
+ dsplit 5 /FOO/
+ call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
+ close
+ call assert_fails('dsplit 3 FOO', 'E387:')
+ call assert_fails('dsplit 6 FOO', 'E388:')
+ call assert_fails('dsplit BAR', 'E388:')
+
+ close!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index a422a6df8..a75e5f6f2 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -2061,6 +2061,16 @@ func Test_deep_nest()
call delete('Xscript')
endfunc
+" Test for <sfile>, <slnum> in a function {{{1
+func Test_sfile_in_function()
+ func Xfunc()
+ call assert_match('..Test_sfile_in_function\[5]..Xfunc', expand('<sfile>'))
+ call assert_equal('2', expand('<slnum>'))
+ endfunc
+ call Xfunc()
+ delfunc Xfunc
+endfunc
+
"-------------------------------------------------------------------------------
" Modelines {{{1
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_visual.vim b/src/testdir/test_visual.vim
index ae281238e..601ad0fbe 100644
--- a/src/testdir/test_visual.vim
+++ b/src/testdir/test_visual.vim
@@ -894,4 +894,18 @@ func Test_block_insert_replace_tabs()
bwipe!
endfunc
+" Test for * register in :
+func Test_star_register()
+ call assert_fails('*bfirst', 'E16:')
+ new
+ call setline(1, ['foo', 'bar', 'baz', 'qux'])
+ exe "normal jVj\<ESC>"
+ *yank r
+ call assert_equal("bar\nbaz\n", @r)
+
+ delmarks < >
+ call assert_fails('*yank', 'E20:')
+ close!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index 24501e14c..362b0eb02 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -940,6 +940,15 @@ func Test_window_only()
new
call assert_fails('only', 'E445:')
only!
+ " Test for :only with a count
+ let wid = win_getid()
+ new
+ new
+ 3only
+ call assert_equal(1, winnr('$'))
+ call assert_equal(wid, win_getid())
+ call assert_fails('close', 'E444:')
+ call assert_fails('%close', 'E16:')
endfunc
" Test for errors with :wincmd
diff --git a/src/testdir/test_writefile.vim b/src/testdir/test_writefile.vim
index f616980f3..544907122 100644
--- a/src/testdir/test_writefile.vim
+++ b/src/testdir/test_writefile.vim
@@ -215,9 +215,7 @@ func Test_write_errors()
close!
call assert_fails('w > Xtest', 'E494:')
-
- call assert_fails('w > Xtest', 'E494:')
-
+
" Try to overwrite a directory
if has('unix')
call mkdir('Xdir1')
diff --git a/src/version.c b/src/version.c
index 4ea036744..e27ac7152 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 270,
+/**/
269,
/**/
268,