{
return &t_string;
}
- static type_T * ret_list_any(int argcount UNUSED, type_T **argtypes UNUSED)
+ static type_T *
+ret_list_any(int argcount UNUSED, type_T **argtypes UNUSED)
{
return &t_list_any;
}
return &t_blob;
}
static type_T *
-ret_partial_void(int argcount UNUSED, type_T **argtypes UNUSED)
+ret_func_any(int argcount UNUSED, type_T **argtypes UNUSED)
{
- return &t_partial_void;
+ return &t_func_any;
+}
+ static type_T *
+ret_partial_any(int argcount UNUSED, type_T **argtypes UNUSED)
+{
+ return &t_partial_any;
}
static type_T *
ret_channel(int argcount UNUSED, type_T **argtypes UNUSED)
{"foldtext", 0, 0, 0, ret_string, f_foldtext},
{"foldtextresult", 1, 1, FEARG_1, ret_string, f_foldtextresult},
{"foreground", 0, 0, 0, ret_void, f_foreground},
- {"funcref", 1, 3, FEARG_1, ret_partial_void, f_funcref},
+ {"funcref", 1, 3, FEARG_1, ret_partial_any, f_funcref},
{"function", 1, 3, FEARG_1, ret_f_function, f_function},
{"garbagecollect", 0, 1, 0, ret_void, f_garbagecollect},
{"get", 2, 3, FEARG_1, ret_any, f_get},
{"test_null_blob", 0, 0, 0, ret_blob, f_test_null_blob},
{"test_null_channel", 0, 0, 0, ret_channel, JOB_FUNC(f_test_null_channel)},
{"test_null_dict", 0, 0, 0, ret_dict_any, f_test_null_dict},
+ {"test_null_function", 0, 0, 0, ret_func_any, f_test_null_function},
{"test_null_job", 0, 0, 0, ret_job, JOB_FUNC(f_test_null_job)},
{"test_null_list", 0, 0, 0, ret_list_any, f_test_null_list},
- {"test_null_partial", 0, 0, 0, ret_partial_void, f_test_null_partial},
+ {"test_null_partial", 0, 0, 0, ret_partial_any, f_test_null_partial},
{"test_null_string", 0, 0, 0, ret_string, f_test_null_string},
{"test_option_not_set", 1, 1, FEARG_1,ret_void, f_test_option_not_set},
{"test_override", 2, 2, FEARG_2, ret_void, f_test_override},
assert_equal('aregadd', @a)
call CheckDefFailure(['@a += "more"'], 'E1013:')
call CheckDefFailure(['@a += 123'], 'E1013:')
+
+ v:errmsg = 'none'
+ v:errmsg ..= 'again'
+ assert_equal('noneagain', v:errmsg)
+ call CheckDefFailure(['v:errmsg += "more"'], 'E1013:')
+ call CheckDefFailure(['v:errmsg += 123'], 'E1013:')
+
+ " Test default values.
+ let thebool: bool
+ assert_equal(v:false, thebool)
+
+ let thenumber: number
+ assert_equal(0, thenumber)
+
+ if has('float')
+ let thefloat: float
+ assert_equal(0.0, thefloat)
+ endif
+
+ let thestring: string
+ assert_equal('', thestring)
+
+ let theblob: blob
+ assert_equal(0z, theblob)
+
+ let thefunc: func
+ assert_equal(test_null_function(), thefunc)
+
+ let thepartial: partial
+ assert_equal(test_null_partial(), thepartial)
+
+ let thelist: list<any>
+ assert_equal([], thelist)
+
+ let thedict: dict<any>
+ assert_equal({}, thedict)
+
+ let thejob: job
+ assert_equal(test_null_job(), thejob)
+
+ let thechannel: channel
+ assert_equal(test_null_channel(), thechannel)
enddef
func Test_assignment_failure()
call CheckDefFailure(['let [a; b; c] = g:list'], 'E452:')
+ call CheckDefFailure(['let somevar'], "E1022:")
call CheckDefFailure(['let &option'], 'E1052:')
call CheckDefFailure(['&g:option = 5'], 'E113:')