mirror of
https://github.com/vim/vim.git
synced 2025-08-26 20:03:41 -04:00
patch 9.1.1569: tests: Vim9 tests can be improved
Problem: tests: Vim9 tests can be improved Solution: In Test_has_func_shortcircuit(), move the test functions to a separate script (Yegappan Lakshmanan) closes: #17796 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
d3170f59e0
commit
ba023e135b
@ -5267,59 +5267,83 @@ enddef
|
|||||||
|
|
||||||
" Test for using more than one has() check in a compound if condition.
|
" Test for using more than one has() check in a compound if condition.
|
||||||
def Test_has_func_shortcircuit()
|
def Test_has_func_shortcircuit()
|
||||||
def Has_And1_Cond(): string
|
var lines =<< trim END
|
||||||
# true && false
|
vim9script
|
||||||
if has('jumplist') && has('foobar')
|
def Has_And1_Cond(): string
|
||||||
return 'present'
|
# true && false
|
||||||
endif
|
if has('jumplist') && has('foobar')
|
||||||
return 'missing'
|
return 'present'
|
||||||
enddef
|
endif
|
||||||
assert_equal('missing', Has_And1_Cond())
|
return 'missing'
|
||||||
|
enddef
|
||||||
|
assert_equal('missing', Has_And1_Cond())
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
def Has_And2_Cond(): string
|
lines =<< trim END
|
||||||
# false && true
|
vim9script
|
||||||
if has('foobar') && has('jumplist')
|
def Has_And2_Cond(): string
|
||||||
return 'present'
|
# false && true
|
||||||
endif
|
if has('foobar') && has('jumplist')
|
||||||
return 'missing'
|
return 'present'
|
||||||
enddef
|
endif
|
||||||
assert_equal('missing', Has_And2_Cond())
|
return 'missing'
|
||||||
|
enddef
|
||||||
|
assert_equal('missing', Has_And2_Cond())
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
def Has_And3_Cond(): string
|
lines =<< trim END
|
||||||
# false && false
|
vim9script
|
||||||
if has('foobar') && has('foobaz')
|
def Has_And3_Cond(): string
|
||||||
return 'present'
|
# false && false
|
||||||
endif
|
if has('foobar') && has('foobaz')
|
||||||
return 'missing'
|
return 'present'
|
||||||
enddef
|
endif
|
||||||
assert_equal('missing', Has_And3_Cond())
|
return 'missing'
|
||||||
|
enddef
|
||||||
|
assert_equal('missing', Has_And3_Cond())
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
def Has_Or1_Cond(): string
|
lines =<< trim END
|
||||||
# true || false
|
vim9script
|
||||||
if has('jumplist') || has('foobar')
|
def Has_Or1_Cond(): string
|
||||||
return 'present'
|
# true || false
|
||||||
endif
|
if has('jumplist') || has('foobar')
|
||||||
return 'missing'
|
return 'present'
|
||||||
enddef
|
endif
|
||||||
assert_equal('present', Has_Or1_Cond())
|
return 'missing'
|
||||||
|
enddef
|
||||||
|
assert_equal('present', Has_Or1_Cond())
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
def Has_Or2_Cond(): string
|
lines =<< trim END
|
||||||
# false || true
|
vim9script
|
||||||
if has('foobar') || has('jumplist')
|
def Has_Or2_Cond(): string
|
||||||
return 'present'
|
# false || true
|
||||||
endif
|
if has('foobar') || has('jumplist')
|
||||||
return 'missing'
|
return 'present'
|
||||||
enddef
|
endif
|
||||||
assert_equal('present', Has_Or2_Cond())
|
return 'missing'
|
||||||
|
enddef
|
||||||
|
assert_equal('present', Has_Or2_Cond())
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
|
|
||||||
def Has_Or3_Cond(): string
|
lines =<< trim END
|
||||||
# false || false
|
vim9script
|
||||||
if has('foobar') || has('foobaz')
|
def Has_Or3_Cond(): string
|
||||||
return 'present'
|
# false || false
|
||||||
endif
|
if has('foobar') || has('foobaz')
|
||||||
return 'missing'
|
return 'present'
|
||||||
enddef
|
endif
|
||||||
assert_equal('missing', Has_Or3_Cond())
|
return 'missing'
|
||||||
|
enddef
|
||||||
|
assert_equal('missing', Has_Or3_Cond())
|
||||||
|
END
|
||||||
|
v9.CheckSourceSuccess(lines)
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
" Test for using more than one len() function in a compound if condition.
|
" Test for using more than one len() function in a compound if condition.
|
||||||
|
@ -719,6 +719,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1569,
|
||||||
/**/
|
/**/
|
||||||
1568,
|
1568,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user