]> granicus.if.org Git - vim/commitdiff
patch 8.2.0448: various functions not properly tested v8.2.0448
authorBram Moolenaar <Bram@vim.org>
Wed, 25 Mar 2020 21:23:46 +0000 (22:23 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 25 Mar 2020 21:23:46 +0000 (22:23 +0100)
Problem:    Various functions not properly tested.
Solution:   Add more tests, especially for failures. (Yegappan Lakshmanan,
            closes #5843)

26 files changed:
runtime/doc/eval.txt
src/testdir/test_blob.vim
src/testdir/test_breakindent.vim
src/testdir/test_charsearch.vim
src/testdir/test_clientserver.vim
src/testdir/test_cmdline.vim
src/testdir/test_exists.vim
src/testdir/test_expand_func.vim
src/testdir/test_expr.vim
src/testdir/test_file_perm.vim
src/testdir/test_functions.vim
src/testdir/test_gui.vim
src/testdir/test_listdict.vim
src/testdir/test_marks.vim
src/testdir/test_partial.vim
src/testdir/test_registers.vim
src/testdir/test_search.vim
src/testdir/test_spell.vim
src/testdir/test_substitute.vim
src/testdir/test_syn_attr.vim
src/testdir/test_syntax.vim
src/testdir/test_taglist.vim
src/testdir/test_utf8.vim
src/testdir/test_vartabs.vim
src/testdir/test_window_cmd.vim
src/version.c

index 00df404785909cf2d1b24589f874554c39c69634..fa25955c7bd5965cb2527ad3293640c4e30a17dc 100644 (file)
@@ -8802,6 +8802,7 @@ setqflist({list} [, {action} [, {what}]])         *setqflist()*
                                                        *setreg()*
 setreg({regname}, {value} [, {options}])
                Set the register {regname} to {value}.
+               If {regname} is "" or "@", the unnamed register '"' is used.
                {value} may be any value returned by |getreg()|, including
                a |List|.
                If {options} contains "a" or {regname} is upper case,
index fb56173f2892d41f3682b0ec42177e224a428fc1..2e5ef0b1c05f4af0d8d808de5036957b31097d41 100644 (file)
@@ -286,6 +286,8 @@ func Test_blob_index()
   call assert_equal(3, 0z11110111->index(0x11, 2))
   call assert_equal(2, index(0z11111111, 0x11, -2))
   call assert_equal(3, index(0z11110111, 0x11, -2))
+  call assert_equal(0, index(0z11110111, 0x11, -10))
+  call assert_fails("echo index(0z11110111, 0x11, [])", 'E745:')
 
   call assert_fails('call index("asdf", 0)', 'E897:')
 endfunc
@@ -331,3 +333,5 @@ func Test_blob_sort()
     call assert_fails('call sort(["abc", 0z11], "f")', 'E702:')
   endif
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index ad4ae1dc26aa51e7b83a37dec93f853c7b141790..aea0572c305469716834048a004c263fe7a984c4 100644 (file)
@@ -417,6 +417,7 @@ func Test_breakindent11()
   let width = strlen(text[1:]) + indent(2) + strlen(&sbr) * 3 " text wraps 3 times
   call assert_equal(width, strdisplaywidth(text))
   call s:close_windows('set sbr=')
+  call assert_equal(4, strdisplaywidth("\t", 4))
 endfunc
 
 func Test_breakindent11_vartabs()
@@ -694,3 +695,5 @@ func Test_breakindent19_sbr_nextpage()
   call s:compare_lines(expect, lines)
   call s:close_windows('set breakindent& briopt& sbr&')
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index 683bcabe34b72301d3a6b5385be9cbb004487805..e6301a5c05662f7a4a9961ccfab3c85f23b20912 100644 (file)
@@ -29,6 +29,8 @@ func Test_charsearch()
   set cpo-=;
   normal! ;;p
   call assert_equal('ZabcdeZfghijkZZemnokqretkZvwxyz', getline(3))
+
+  call assert_fails("call setcharsearch([])", 'E715:')
   enew!
 endfunc
 
index f358117a8f8b69c01a16d30c0cbf91f5626a243d..1cbcb19f100566e8fc332a7b78cbdbd75bf327a7 100644 (file)
@@ -98,7 +98,11 @@ func Test_client_server()
       call job_stop(job, 'kill')
     endif
   endtry
+
+  call assert_fails("let x=remote_peek([])", 'E730:')
 endfunc
 
 " Uncomment this line to get a debugging log
 " call ch_logfile('channellog', 'w')
+
+" vim: shiftwidth=2 sts=2 expandtab
index c41effe077fd1cbebf3b4db201d68f81a6dfd800..9a2c3a3513d988f29686974a762020261e48fdbb 100644 (file)
@@ -68,6 +68,11 @@ func Test_complete_wildmenu()
   call assert_equal('"e Xtestfile3 Xtestfile4', @:)
   cd -
 
+  cnoremap <expr> <F2> wildmenumode()
+  call feedkeys(":cd Xdir\<Tab>\<F2>\<C-B>\"\<CR>", 'tx')
+  call assert_equal('"cd Xdir1/1', @:)
+  cunmap <F2>
+
   " cleanup
   %bwipe
   call delete('Xdir1/Xdir2/Xtestfile4')
index 471c77853d20430767737aad5cc0243a98ed6b9a..62c66192ef6c6a2e4a197d4bee9a2c4b13313ff4 100644 (file)
@@ -68,6 +68,10 @@ func Test_exists()
   " Existing environment variable
   let $EDITOR_NAME = 'Vim Editor'
   call assert_equal(1, exists('$EDITOR_NAME'))
+  if has('unix')
+    " ${name} environment variables are supported only on Unix-like systems
+    call assert_equal(1, exists('${VIM}'))
+  endif
   " Non-existing environment variable
   call assert_equal(0, exists('$NON_ENV_VAR'))
 
@@ -323,3 +327,5 @@ endfunc
 func Test_exists_funcarg()
   call FuncArg_Tests("arg1", "arg2")
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index c408deae6412dab0ce17bbef33179b49a09be899..18437b75880b8dd8923bff4cef8518e2a39f35d2 100644 (file)
@@ -83,6 +83,7 @@ func Test_expand_wildignore()
   call assert_equal('test_expand_func.vim', expand('test_expand_func.vim', 1))
   call assert_equal(['test_expand_func.vim'],
         \ expand('test_expand_func.vim', 1, 1))
+  call assert_fails("call expand('*', [])", 'E745:')
   set wildignore&
 endfunc
 
index b04b99ec040852cd3d99c6d8503743df7a2a84f8..13180e6929a0be678cb8d1d97a98358ad63d84ff 100644 (file)
@@ -59,6 +59,8 @@ func Test_strgetchar()
   call assert_equal(-1, strgetchar('axb', -1))
   call assert_equal(-1, strgetchar('axb', 3))
   call assert_equal(-1, strgetchar('', 0))
+  call assert_fails("let c=strgetchar([], 1)", 'E730:')
+  call assert_fails("let c=strgetchar('axb', [])", 'E745:')
 endfunc
 
 func Test_strcharpart()
@@ -444,6 +446,9 @@ func Test_substitute_expr()
   endfunc
   " recursive call works
   call assert_equal('-y-x-', substitute('xxx', 'x\(.\)x', {-> '-' . Recurse() . '-' . submatch(1) . '-'}, ''))
+
+  call assert_fails("let s=submatch([])", 'E745:')
+  call assert_fails("let s=submatch(2, [])", 'E745:')
 endfunc
 
 func Test_invalid_submatch()
index 39501684f0f2fc7532da421916288e3cbd007c54..1cb09e864723638f135af321652a3a2d4957146d 100644 (file)
@@ -21,4 +21,10 @@ func Test_file_perm()
 
   call assert_equal(1, setfperm('Xtest', 'rwx------'))
   call delete('Xtest')
+
+  call assert_fails("call setfperm(['Xfile'], 'rw-rw-rw-')", 'E730:')
+  call assert_fails("call setfperm('Xfile', [])", 'E730:')
+  call assert_fails("call setfperm('Xfile', 'rwxrwxrwxrw')", 'E475:')
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index 96d7f31f475514318aedd56413140af4c880cccc..fd5cde8ee0fe92ace1c8e8341533835ff060dd8d 100644 (file)
@@ -24,8 +24,18 @@ func Test_has()
   call assert_equal(1, has('eval'))
   call assert_equal(1, has('eval', 1))
 
+  if has('unix')
+    call assert_equal(1, or(has('ttyin'), 1))
+    call assert_equal(0, and(has('ttyout'), 0))
+    call assert_equal(1, has('multi_byte_encoding'))
+  endif
+
   call assert_equal(0, has('nonexistent'))
   call assert_equal(0, has('nonexistent', 1))
+
+  " Will we ever have patch 9999?
+  let ver = 'patch-' .. v:version / 100 .. '.' .. v:version % 100 .. '.9999'
+  call assert_equal(0, has(ver))
 endfunc
 
 func Test_empty()
@@ -476,6 +486,8 @@ func Test_strpart()
   call assert_equal('abcdefg', 'abcdefg'->strpart(-2))
   call assert_equal('fg', strpart('abcdefg', 5, 4))
   call assert_equal('defg', strpart('abcdefg', 3))
+  call assert_equal('', strpart('abcdefg', 10))
+  call assert_fails("let s=strpart('abcdef', [])", 'E745:')
 
   call assert_equal('lép', strpart('éléphant', 2, 4))
   call assert_equal('léphant', strpart('éléphant', 2))
@@ -629,6 +641,15 @@ endfunc
 func Test_tr()
   call assert_equal('foo', tr('bar', 'bar', 'foo'))
   call assert_equal('zxy', 'cab'->tr('abc', 'xyz'))
+  call assert_fails("let s=tr([], 'abc', 'def')", 'E730:')
+  call assert_fails("let s=tr('abc', [], 'def')", 'E730:')
+  call assert_fails("let s=tr('abc', 'abc', [])", 'E730:')
+  call assert_fails("let s=tr('abcd', 'abcd', 'def')", 'E475:')
+  set encoding=latin1
+  call assert_fails("let s=tr('abcd', 'abcd', 'def')", 'E475:')
+  call assert_equal('hEllO', tr('hello', 'eo', 'EO'))
+  call assert_equal('hello', tr('hello', 'xy', 'ab'))
+  set encoding=utf8
 endfunc
 
 " Tests for the mode() function
@@ -840,6 +861,8 @@ func Test_stridx()
   call assert_equal(-1, stridx('hello', 'l', 10))
   call assert_equal(2,  stridx('hello', 'll'))
   call assert_equal(-1, stridx('hello', 'hello world'))
+  call assert_fails("let n=stridx('hello', [])", 'E730:')
+  call assert_fails("let n=stridx([], 'l')", 'E730:')
 endfunc
 
 func Test_strridx()
@@ -856,6 +879,8 @@ func Test_strridx()
   call assert_equal(-1, strridx('hello', 'l', -1))
   call assert_equal(2,  strridx('hello', 'll'))
   call assert_equal(-1, strridx('hello', 'hello world'))
+  call assert_fails("let n=strridx('hello', [])", 'E730:')
+  call assert_fails("let n=strridx([], 'l')", 'E730:')
 endfunc
 
 func Test_match_func()
@@ -865,6 +890,11 @@ func Test_match_func()
   call assert_equal(-1, match('testing', 'ing', 8))
   call assert_equal(1, match(['vim', 'testing', 'execute'], 'ing'))
   call assert_equal(-1, match(['vim', 'testing', 'execute'], 'img'))
+  call assert_fails("let x=match('vim', [])", 'E730:')
+  call assert_equal(3, match(['a', 'b', 'c', 'a'], 'a', 1))
+  call assert_equal(-1, match(['a', 'b', 'c', 'a'], 'a', 5))
+  call assert_equal(4,  match('testing', 'ing', -1))
+  call assert_fails("let x=match('testing', 'ing', 0, [])", 'E745:')
 endfunc
 
 func Test_matchend()
@@ -971,6 +1001,7 @@ func Test_byte2line_line2byte()
   bw!
 endfunc
 
+" Test for byteidx() and byteidxcomp() functions
 func Test_byteidx()
   let a = '.é.' " one char of two bytes
   call assert_equal(0, byteidx(a, 0))
@@ -990,6 +1021,7 @@ func Test_byteidx()
   call assert_equal(4, b->byteidx(2))
   call assert_equal(5, b->byteidx(3))
   call assert_equal(-1, b->byteidx(4))
+  call assert_fails("call byteidx([], 0)", 'E730:')
 
   call assert_equal(0, b->byteidxcomp(0))
   call assert_equal(1, b->byteidxcomp(1))
@@ -997,6 +1029,7 @@ func Test_byteidx()
   call assert_equal(4, b->byteidxcomp(3))
   call assert_equal(5, b->byteidxcomp(4))
   call assert_equal(-1, b->byteidxcomp(5))
+  call assert_fails("call byteidxcomp([], 0)", 'E730:')
 endfunc
 
 func Test_count()
@@ -1177,6 +1210,22 @@ func Test_col()
   xunmap <F2>
   delfunc T
 
+  " Test for the visual line start and end marks '< and '>
+  call setline(1, ['one', 'one two', 'one two three'])
+  "normal! ggVG
+  call feedkeys("ggVG\<Esc>", 'xt')
+  call assert_equal(1, col("'<"))
+  call assert_equal(14, col("'>"))
+  " Delete the last line of the visually selected region
+  $d
+  call assert_notequal(14, col("'>"))
+
+  " Test with 'virtualedit'
+  set virtualedit=all
+  call cursor(1, 10)
+  call assert_equal(4, col('.'))
+  set virtualedit&
+
   bw!
 endfunc
 
@@ -1343,6 +1392,8 @@ func Test_trim()
 
   let chars = join(map(range(1, 0x20) + [0xa0], {n -> n->nr2char()}), '')
   call assert_equal("x", trim(chars . "x" . chars))
+
+  call assert_fails('let c=trim([])', 'E730:')
 endfunc
 
 " Test for reg_recording() and reg_executing()
@@ -1726,6 +1777,9 @@ endfunc
 func Test_char2nr()
   call assert_equal(12354, char2nr('あ', 1))
   call assert_equal(120, 'x'->char2nr())
+  set encoding=latin1
+  call assert_equal(120, 'x'->char2nr())
+  set encoding=utf-8
 endfunc
 
 func Test_eventhandler()
@@ -1931,6 +1985,7 @@ func Test_range()
 
   " index()
   call assert_equal(1, index(range(1, 5), 2))
+  call assert_fails("echo index([1, 2], 1, [])", 'E745:')
 
   " inputlist()
   call feedkeys(":let result = inputlist(range(10))\<CR>1\<CR>", 'x')
@@ -2089,6 +2144,11 @@ func Test_range()
 
   " uniq()
   call assert_equal([0, 1, 2, 3, 4], uniq(range(5)))
+
+  " errors
+  call assert_fails('let x=range(2, 8, 0)', 'E726:')
+  call assert_fails('let x=range(3, 1)', 'E727:')
+  call assert_fails('let x=range(1, 3, -2)', 'E727:')
 endfunc
 
 func Test_echoraw()
@@ -2107,4 +2167,25 @@ func Test_echoraw()
   call delete('XTest_echoraw')
 endfunc
 
+" Test for the eval() function
+func Test_eval()
+  call assert_fails("call eval('5 a')", 'E488:')
+endfunc
+
+" Test for the nr2char() function
+func Test_nr2char()
+  set encoding=latin1
+  call assert_equal('@', nr2char(64))
+  set encoding=utf8
+  call assert_equal('a', nr2char(97, 1))
+  call assert_equal('a', nr2char(97, 0))
+endfunc
+
+" Test for screenattr(), screenchar() and screenchars() functions
+func Test_screen_functions()
+  call assert_equal(-1, screenattr(-1, -1))
+  call assert_equal(-1, screenchar(-1, -1))
+  call assert_equal([], screenchars(-1, -1))
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index e3ec4aadfdf689b0943d911b8669796ec8b7795c..54ba588f7f1bc099ad640e1585873296abc38f83 100644 (file)
@@ -75,6 +75,7 @@ func Test_getfontname_with_arg()
   elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
     " Invalid font name. The result should be the name plus the default size.
     call assert_equal('notexist 10', getfontname('notexist'))
+    call assert_equal('', getfontname('*'))
 
     " Valid font name. This is usually the real name of Monospace by default.
     let fname = 'Bitstream Vera Sans Mono 12'
@@ -825,3 +826,5 @@ func Test_gui_dash_y()
   call delete('Xscriptgui')
   call delete('Xtestgui')
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index 4c9870db8399baaa74701b04302b366b28c28779..045dbb08537643144eb0f03202a305cd153a8985 100644 (file)
@@ -302,6 +302,7 @@ func Test_dict_deepcopy()
   let l[1] = l2
   let l3 = deepcopy(l2)
   call assert_true(l3[1] is l3[2])
+  call assert_fails("call deepcopy([1, 2], 2)", 'E474:')
 endfunc
 
 " Locked variables
@@ -381,6 +382,11 @@ func Test_list_locked_var()
       call assert_equal(expected[depth][u][1], ps)
     endfor
   endfor
+  call assert_fails("let x=islocked('a b')", 'E488:')
+  let mylist = [1, 2, 3]
+  call assert_fails("let x = islocked('mylist[1:2]')", 'E786:')
+  let mydict = {'k' : 'v'}
+  call assert_fails("let x = islocked('mydict.a')", 'E716:')
 endfunc
 
 " Unletting locked variables
@@ -629,7 +635,7 @@ func Test_reverse_sort_uniq()
   call assert_fails('call reverse("")', 'E899:')
 endfunc
 
-" splitting a string to a List
+" splitting a string to a List using split()
 func Test_str_split()
   call assert_equal(['aa', 'bb'], split('  aa  bb '))
   call assert_equal(['aa', 'bb'], split('  aa  bb  ', '\W\+', 0))
@@ -640,6 +646,8 @@ func Test_str_split()
   call assert_equal(['aa', '', 'bb', 'cc', ''], split('aa,,bb, cc,', ',\s*', 1))
   call assert_equal(['a', 'b', 'c'], split('abc', '\zs'))
   call assert_equal(['', 'a', '', 'b', '', 'c', ''], split('abc', '\zs', 1))
+  call assert_fails("call split('abc', [])", 'E730:')
+  call assert_fails("call split('abc', 'b', [])", 'E745:')
 endfunc
 
 " compare recursively linked list and dict
index 1d1f3630389938a87ac1308a12661209e03e35c5..15be08013710c973100085e7a212b0376fe72359 100644 (file)
@@ -90,6 +90,8 @@ func Test_setpos()
   call setpos('.', [0, 1, -1, 0])
   call assert_equal([2, 2], [line('.'), col('.')])
 
+  call assert_fails("call setpos('ab', [0, 1, 1, 0])", 'E474:')
+
   bwipe!
   call win_gotoid(twowin)
   bwipe!
index 3cd0be28d8052ebfbf3252860e336a6bd9314014..1e682d5229c7c6fb63f15a3cf91a8932287a2700 100644 (file)
@@ -83,6 +83,9 @@ func Test_partial_dict()
 
   let dict = {"tr": function('tr', ['hello', 'h', 'H'])}
   call assert_equal("Hello", dict.tr())
+
+  call assert_fails("let F=function('setloclist', 10)", "E923:")
+  call assert_fails("let F=function('setloclist', [], [])", "E922:")
 endfunc
 
 func Test_partial_implicit()
@@ -389,3 +392,5 @@ func Test_compare_partials()
   call assert_true(F1 isnot# F1d1)  " Partial /= non-partial
   call assert_true(d1.f1 isnot# d1.f1)  " handle_subscript creates new partial each time
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index 0f86987136d911d8d344e4148146151f9852b63b..7e7bc07b22ad5b1e9fd2bfcee43740b3df712a56 100644 (file)
@@ -235,8 +235,16 @@ func Test_get_register()
   call assert_equal('', getreg("\<C-F>"))
   call assert_equal('', getreg("\<C-W>"))
   call assert_equal('', getreg("\<C-L>"))
+  " Change the last used register to '"' for the next test
+  normal! ""yy
+  let @" = 'happy'
+  call assert_equal('happy', getreg())
+  call assert_equal('happy', getreg(''))
 
   call assert_equal('', getregtype('!'))
+  call assert_fails('echo getregtype([])', 'E730:')
+  call assert_equal('v', getregtype())
+  call assert_equal('v', getregtype(''))
 
   " Test for inserting an invalid register content
   call assert_beeps('exe "normal i\<C-R>!"')
@@ -316,6 +324,12 @@ func Test_set_register()
   normal 0".gP
   call assert_equal('abcabcabc', getline(1))
 
+  let @"=''
+  call setreg('', '1')
+  call assert_equal('1', @")
+  call setreg('@', '2')
+  call assert_equal('2', @")
+
   enew!
 endfunc
 
index c607a14c9d84b4aaa8572f5d43aff5a1eaf01e4b..d57dbd7e5b8ddb822bb729cb47440098b7d30bd6 100644 (file)
@@ -1385,6 +1385,15 @@ func Test_search_match_at_curpos()
   close!
 endfunc
 
+" Test for error cases with the search() function
+func Test_search_errors()
+  call assert_fails("call search('pat', [])", 'E730:')
+  call assert_fails("call search('pat', 'b', {})", 'E728:')
+  call assert_fails("call search('pat', 'b', 1, [])", 'E745:')
+  call assert_fails("call search('pat', 'ns')", 'E475:')
+  call assert_fails("call search('pat', 'mr')", 'E475:')
+endfunc
+
 func Test_search_display_pattern()
   new
   call setline(1, ['foo', 'bar', 'foobar'])
index 5755146e03c120864f7eec5838989b22ddc990d9..4e376b8102348dd60e9a9aedf2a03d64206ff922 100644 (file)
@@ -160,6 +160,9 @@ func Test_spellsuggest()
   call assert_equal(['Third'], spellsuggest('THird', 1))
   call assert_equal(['All'],      spellsuggest('ALl', 1))
 
+  call assert_fails("call spellsuggest('maxch', [])", 'E745:')
+  call assert_fails("call spellsuggest('maxch', 2, [])", 'E745:')
+
   set spell&
 endfunc
 
@@ -1164,3 +1167,5 @@ let g:test_data_aff_sal = [
       \"SAL ZZ-                  _",
       \"SAL Z                    S",
       \ ]
+
+" vim: shiftwidth=2 sts=2 expandtab
index 2ac6f45419b5df728a4007823efdf7f8e1d249ad..b4105fab29c9613b7124f029b09faec24eff9d95 100644 (file)
@@ -242,6 +242,11 @@ func Test_substitute_errors()
   setl nomodifiable
   call assert_fails('s/foo/bar/', 'E21:')
 
+  call assert_fails("let s=substitute([], 'a', 'A', 'g')", 'E730:')
+  call assert_fails("let s=substitute('abcda', [], 'A', 'g')", 'E730:')
+  call assert_fails("let s=substitute('abcda', 'a', [], 'g')", 'E730:')
+  call assert_fails("let s=substitute('abcda', 'a', 'A', [])", 'E730:')
+
   bwipe!
 endfunc
 
index a27a2cbe479106072732098e94a3eeb661ed0039..db9c9e93af1b72966ed8832db0e020c4da301eee 100644 (file)
@@ -4,6 +4,8 @@ func Test_missing_attr()
   hi Mine term=bold cterm=italic
   call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
   call assert_equal('', synIDattr("Mine"->hlID(), "bg", 'term'))
+  call assert_equal('', synIDattr("Mine"->hlID(), "fg", 'term'))
+  call assert_equal('', synIDattr("Mine"->hlID(), "sp", 'term'))
   call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term'))
   call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
   hi Mine term=reverse cterm=inverse
@@ -819,3 +821,5 @@ func Test_color_names()
   hi Mine guifg=blanchedalmond
   hi Mine guifg=BLANCHEDALMOND
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index 389294ec7e7103918b99ff53c554e7fe439371dc..8197f1af548724d0a96249998005ffdf87825b8d 100644 (file)
@@ -532,6 +532,8 @@ func Test_synstack_synIDtrans()
   call assert_equal(['cComment', 'cTodo'], map(synstack(line("."), col(".")), 'synIDattr(v:val, "name")'))
   call assert_equal(['Comment', 'Todo'],   map(synstack(line("."), col(".")), 'synIDattr(synIDtrans(v:val), "name")'))
 
+  call assert_fails("let n=synIDtrans([])", 'E745:')
+
   syn clear
   bw!
 endfunc
@@ -631,3 +633,5 @@ func Test_syntax_after_bufdo()
   call delete('Xccc.c')
   call delete('Xddd.c')
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index fa159d73d5a5b618c664b3dc14fdb7b53fca3e49..5252d24d72d9c73168e5679b1f97359b0418b392 100644 (file)
@@ -36,6 +36,8 @@ func Test_taglist()
   call assert_equal('d', cmd[0]['kind'])
   call assert_equal('call cursor(3, 4)', cmd[0]['cmd'])
 
+  call assert_fails("let l=taglist([])", 'E730:')
+
   call delete('Xtags')
   set tags&
   bwipe
index 42a46fd435147445462b5bb359619c106c70b971..fa6f76a6107aa37c4752f349bc17cc5e9b1aa7bb 100644 (file)
@@ -20,6 +20,8 @@ func Test_strchars()
     call assert_equal(exp[i][1], inp[i]->strchars(0))
     call assert_equal(exp[i][2], strchars(inp[i], 1))
   endfor
+  call assert_fails("let v=strchars('abc', [])", 'E474:')
+  call assert_fails("let v=strchars('abc', 2)", 'E474:')
 endfunc
 
 " Test for customlist completion
@@ -99,6 +101,7 @@ func Test_list2str_str2list_latin1()
   
   let lres = str2list(s, 1)
   let sres = list2str(l, 1)
+  call assert_equal([65, 66, 67], str2list("ABC"))
 
   let &encoding = save_encoding
   call assert_equal(l, lres)
@@ -138,3 +141,5 @@ func Test_screenchar_utf8()
 
   bwipe!
 endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
index 3596722adccbc4c91907c815b9835dce945498ad..95fffe05aefef8e21b6da4a22a7d69841972c5ed 100644 (file)
@@ -369,6 +369,8 @@ func Test_vartabs_shiftwidth()
   let lines = ScreenLines([1, 3], winwidth(0))
   call s:compare_lines(expect4, lines)
 
+  call assert_fails('call shiftwidth([])', 'E745:')
+
   " cleanup
   bw!
   bw!
index 040324d20dc71fff6f46d4d21d6ec063563c7ad0..001bbaca48fc87febb88412d9892399b1f5c7f31 100644 (file)
@@ -525,6 +525,7 @@ func Test_window_newtab()
   call assert_equal(2, tabpagenr('$'))
   call assert_equal(['Xb', 'Xa'], map(tabpagebuflist(1), 'bufname(v:val)'))
   call assert_equal(['Xc'      ], map(2->tabpagebuflist(), 'bufname(v:val)'))
+  call assert_equal(['Xc'      ], map(tabpagebuflist(), 'bufname(v:val)'))
 
   %bw!
 endfunc
index b54ac5aa9525bbdef652096aebaca78d2e53e0d6..f1d2f66adcf5a4b3db8be746049dd2f301a14e17 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    448,
 /**/
     447,
 /**/