diff options
| author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-08-28 22:09:16 -0400 |
|---|---|---|
| committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-08-30 21:12:25 -0400 |
| commit | a45dc02a1421a002923a1e85214ab9d08ead9536 (patch) | |
| tree | c567a69e500255e5284e371c1050a5c52602d95d /src/nvim/testdir | |
| parent | 40fca0cea8d6db8eb93059d1375630012382e465 (diff) | |
| download | rneovim-a45dc02a1421a002923a1e85214ab9d08ead9536.tar.gz rneovim-a45dc02a1421a002923a1e85214ab9d08ead9536.tar.bz2 rneovim-a45dc02a1421a002923a1e85214ab9d08ead9536.zip | |
vim-patch:8.1.2198: crash when using :center in autocommand
Problem: Crash when using :center in autocommand.
Solution: Bail out early for an empty line. (Dominique pelle, closes vim/vim#5095)
https://github.com/vim/vim/commit/396b7c78c0fd9cd07528963b18c27398491df40d
Cherry-pick 'src/testdir/check.vim' changes from patch 8.1.1544.
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/check.vim | 24 | ||||
| -rw-r--r-- | src/nvim/testdir/test_textformat.vim | 20 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index 57a8eb57b8..62adc6bca9 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -1,6 +1,30 @@ source shared.vim source term_util.vim +" Command to check for the presence of a feature. +command -nargs=1 CheckFeature call CheckFeature(<f-args>) +func CheckFeature(name) + if !has(a:name) + throw 'Skipped: ' .. a:name .. ' feature missing' + endif +endfunc + +" Command to check for the presence of a working option. +command -nargs=1 CheckOption call CheckOption(<f-args>) +func CheckOption(name) + if !exists('+' .. a:name) + throw 'Skipped: ' .. a:name .. ' option not supported' + endif +endfunc + +" Command to check for the presence of a function. +command -nargs=1 CheckFunction call CheckFunction(<f-args>) +func CheckFunction(name) + if !exists('*' .. a:name) + throw 'Skipped: ' .. a:name .. ' function missing' + endif +endfunc + " Command to check that making screendumps is supported. " Caller must source screendump.vim command CheckScreendump call CheckScreendump() diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 75673adf0a..2223be952c 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -1,4 +1,7 @@ " Tests for the various 'formatoptions' settings + +source check.vim + func Test_text_format() enew! @@ -490,6 +493,23 @@ func Test_format_list_auto() set fo& ai& bs& endfunc +func Test_crash_github_issue_5095() + CheckFeature autocmd + + " This used to segfault, see https://github.com/vim/vim/issues/5095 + augroup testing + au BufNew x center + augroup END + + next! x + + bw + augroup testing + au! + augroup END + augroup! testing +endfunc + " Test for formatting multi-byte text with 'fo=t' func Test_tw_2_fo_t() new |