Problem: Vim9: count() third argument cannot be "true".
Solution: use tv_get_bool_chk(). (closes #6818)
int error = FALSE;
if (argvars[2].v_type != VAR_UNKNOWN)
- ic = (int)tv_get_number_chk(&argvars[2], &error);
+ ic = (int)tv_get_bool_chk(&argvars[2], &error);
if (argvars[0].v_type == VAR_STRING)
{
endif
enddef
+def Test_count()
+ assert_equal(3, count('ABC ABC ABC', 'b', true))
+ assert_equal(0, count('ABC ABC ABC', 'b', false))
+enddef
+
def Test_recursive_call()
assert_equal(6765, Fibonacci(20))
enddef
tv_get_bool_chk(typval_T *varp, int *denote)
{
return tv_get_bool_or_number_chk(varp, denote, TRUE);
-
}
#ifdef FEAT_FLOAT
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1571,
/**/
1570,
/**/