From 157baef02636fed4a99ef401e470fee8c51ce852 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 26 Oct 2022 21:53:11 +0800 Subject: vim-patch:8.1.1826: tests use hand coded feature and option checks Problem: Tests use hand coded feature and option checks. Solution: Use the commands from check.vim in more tests. https://github.com/vim/vim/commit/8c5a278fc508da6dfe50e69b6ee734451aa4eafb Omit Test_wincolor(): there are later patches that touch that function. Omit test_memory_usage.vim: a Lua test is used for that file. Cherry-pick Test_issue_3969() from patch 8.1.0969. Co-authored-by: Bram Moolenaar --- src/nvim/testdir/check.vim | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/nvim/testdir/check.vim') diff --git a/src/nvim/testdir/check.vim b/src/nvim/testdir/check.vim index 4107df99d6..92a51d4371 100644 --- a/src/nvim/testdir/check.vim +++ b/src/nvim/testdir/check.vim @@ -39,6 +39,22 @@ func CheckFunction(name) endif endfunc +" Command to check for the presence of an Ex command +command -nargs=1 CheckCommand call CheckCommand() +func CheckCommand(name) + if !exists(':' .. a:name) + throw 'Skipped: ' .. a:name .. ' command not supported' + endif +endfunc + +" Command to check for the presence of a shell command +command -nargs=1 CheckExecutable call CheckExecutable() +func CheckExecutable(name) + if !executable(a:name) + throw 'Skipped: ' .. a:name .. ' program not executable' + endif +endfunc + " Command to check for the presence of python. Argument should have been " obtained with PythonProg() func CheckPython(name) -- cgit