Mercurial > vim
comparison src/testdir/check.vim @ 19805:2dc5e6ddeb4c v8.2.0459
patch 8.2.0459: cannot check if a function name is correct
Commit: https://github.com/vim/vim/commit/15c476023f3c5fb32eb1936c5eb5f0f5f413f3c7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 22:16:48 2020 +0100
patch 8.2.0459: cannot check if a function name is correct
Problem: Cannot check if a function name is correct.
Solution: Add "?funcname" to exists().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 26 Mar 2020 22:30:03 +0100 |
parents | 1da2fb80b512 |
children | 031184ace7c5 |
comparison
equal
deleted
inserted
replaced
19804:503120273ab7 | 19805:2dc5e6ddeb4c |
---|---|
23 if !exists('+' .. a:name) | 23 if !exists('+' .. a:name) |
24 throw 'Skipped: ' .. a:name .. ' option not supported' | 24 throw 'Skipped: ' .. a:name .. ' option not supported' |
25 endif | 25 endif |
26 endfunc | 26 endfunc |
27 | 27 |
28 " Command to check for the presence of a function. | 28 " Command to check for the presence of a built-in function. |
29 command -nargs=1 CheckFunction call CheckFunction(<f-args>) | 29 command -nargs=1 CheckFunction call CheckFunction(<f-args>) |
30 func CheckFunction(name) | 30 func CheckFunction(name) |
31 if !exists('?' .. a:name) | |
32 throw 'Checking for non-existent function ' .. a:name | |
33 endif | |
31 if !exists('*' .. a:name) | 34 if !exists('*' .. a:name) |
32 throw 'Skipped: ' .. a:name .. ' function missing' | 35 throw 'Skipped: ' .. a:name .. ' function missing' |
33 endif | 36 endif |
34 endfunc | 37 endfunc |
35 | 38 |