Mercurial > vim
diff src/testdir/test_functions.vim @ 20158:94f05de75e9f v8.2.0634
patch 8.2.0634: crash with null partial and blob
Commit: https://github.com/vim/vim/commit/92b83ccfda7a1d654ccaaf161a9c8a8e01fbcf76
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 25 15:24:44 2020 +0200
patch 8.2.0634: crash with null partial and blob
Problem: Crash with null partial and blob.
Solution: Check for NULL pointer. Add more tests. (Yegappan Lakshmanan,
closes #5984)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 25 Apr 2020 15:30:04 +0200 |
parents | 49694eceaa55 |
children | 2fb397573541 |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -480,6 +480,7 @@ func Test_pathshorten() call assert_equal('~.f/bar', pathshorten('~.foo/bar')) call assert_equal('.~f/bar', pathshorten('.~foo/bar')) call assert_equal('~/f/bar', pathshorten('~/foo/bar')) + call assert_fails('call pathshorten([])', 'E730:') endfunc func Test_strpart() @@ -970,6 +971,7 @@ func Test_matchstrpos() call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 8)) call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing')) call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img')) + call assert_equal(['', -1, -1], matchstrpos(test_null_list(), '\a')) endfunc func Test_nextnonblank_prevnonblank() @@ -1222,6 +1224,7 @@ func Test_hlexists() syntax off endfunc +" Test for the col() function func Test_col() new call setline(1, 'abcdef') @@ -1332,6 +1335,7 @@ func Test_inputlist() call assert_equal(-2, c) call assert_fails('call inputlist("")', 'E686:') + call assert_fails('call inputlist(test_null_list())', 'E686:') endfunc func Test_balloon_show() @@ -2227,6 +2231,16 @@ func Test_echoraw() call delete('XTest_echoraw') endfunc +" Test for echo highlighting +func Test_echohl() + echohl Search + echo 'Vim' + call assert_equal('Vim', Screenline(&lines)) + " TODO: How to check the highlight group used by echohl? + " ScreenAttrs() returns all zeros. + echohl None +endfunc + " Test for the eval() function func Test_eval() call assert_fails("call eval('5 a')", 'E488:') @@ -2258,7 +2272,27 @@ func Test_getcurpos_setpos() call setpos('.', sp) normal jyl call assert_equal('6', @") + call assert_equal(-1, setpos('.', test_null_list())) + call assert_equal(-1, setpos('.', {})) close! endfunc +" Test for glob() +func Test_glob() + call assert_equal('', glob(test_null_string())) + call assert_equal('', globpath(test_null_string(), test_null_string())) +endfunc + +" Test for browse() +func Test_browse() + CheckFeature browse + call assert_fails('call browse([], "open", "x", "a.c")', 'E745:') +endfunc + +" Test for browsedir() +func Test_browsedir() + CheckFeature browse + call assert_fails('call browsedir("open", [])', 'E730:') +endfunc + " vim: shiftwidth=2 sts=2 expandtab