view src/testdir/test60.vim @ 10930:126405b39964 v8.0.0354

patch 8.0.0354: test to check that setting termcap key fails sometimes commit https://github.com/vim/vim/commit/1c410400fad79068b16dc4c6c7a023463a0858cf Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 23 15:20:03 2017 +0100 patch 8.0.0354: test to check that setting termcap key fails sometimes Problem: Test to check that setting termcap key fails sometimes. Solution: Check for "t_k1" to exist. (Christian Brabandt, closes https://github.com/vim/vim/issues/1459)
author Christian Brabandt <cb@256bit.org>
date Thu, 23 Feb 2017 15:30:05 +0100
parents b63792dadc23
children
line wrap: on
line source

" Vim script for exists() function test
" Script-local variables are checked here

" Existing script-local variable
let s:script_var = 1
echo 's:script_var: 1'
if exists('s:script_var')
    echo "OK"
else
    echo "FAILED"
endif

" Non-existing script-local variable
unlet s:script_var
echo 's:script_var: 0'
if !exists('s:script_var')
    echo "OK"
else
    echo "FAILED"
endif

" Existing script-local list
let s:script_list = ["blue", "orange"]
echo 's:script_list: 1'
if exists('s:script_list')
    echo "OK"
else
    echo "FAILED"
endif

" Non-existing script-local list
unlet s:script_list
echo 's:script_list: 0'
if !exists('s:script_list')
    echo "OK"
else
    echo "FAILED"
endif

" Existing script-local dictionary
let s:script_dict = {"xcord":100, "ycord":2}
echo 's:script_dict: 1'
if exists('s:script_dict')
    echo "OK"
else
    echo "FAILED"
endif

" Non-existing script-local dictionary
unlet s:script_dict
echo 's:script_dict: 0'
if !exists('s:script_dict')
    echo "OK"
else
    echo "FAILED"
endif

" Existing script curly-brace variable
let str = "script"
let s:curly_{str}_var = 1
echo 's:curly_' . str . '_var: 1'
if exists('s:curly_{str}_var')
    echo "OK"
else
    echo "FAILED"
endif

" Non-existing script-local curly-brace variable
unlet s:curly_{str}_var
echo 's:curly_' . str . '_var: 0'
if !exists('s:curly_{str}_var')
    echo "OK"
else
    echo "FAILED"
endif

" Existing script-local function
function! s:my_script_func()
endfunction

echo '*s:my_script_func: 1'
if exists('*s:my_script_func')
    echo "OK"
else
    echo "FAILED"
endif

" Non-existing script-local function
delfunction s:my_script_func

echo '*s:my_script_func: 0'
if !exists('*s:my_script_func')
    echo "OK"
else
    echo "FAILED"
endif
unlet str