Problem: Some code lines not covered by tests.
Solution: Add a few more test cases. Fix getting more than one error for
invalid assignment.
INIT(= N_("E1077: Missing argument type for %s"));
// E1078 unused
// E1079 unused
-// E1080 unused
+EXTERN char e_invalid_assignment[]
+ INIT(= N_("E1080: Invalid assignment"));
EXTERN char e_cannot_unlet_str[]
INIT(= N_("E1081: Cannot unlet %s"));
#endif
{
if (*semicolon == 1)
{
- emsg(_(e_double_semicolon_in_list_of_variables));
+ if (!silent)
+ emsg(_(e_double_semicolon_in_list_of_variables));
return NULL;
}
*semicolon = 1;
v9.CheckDefFailure(['var null = 1'], 'E1034:')
v9.CheckDefFailure(['var this = 1'], 'E1034:')
- v9.CheckDefFailure(['[a; b; c] = g:list'], 'E452:')
+ v9.CheckDefFailure(['[a; b; c] = g:list'], 'E1001:')
+ v9.CheckDefFailure(['var [a; b; c] = g:list'], 'E1080:')
v9.CheckDefExecFailure(['var a: number',
'[a] = test_null_list()'], 'E1093:')
v9.CheckDefExecFailure(['var a: number',
END
v9.CheckDefFailure(lines, 'E1146:', 1)
+ lines =<< trim END
+ if 0
+ d.key = 'asdf'
+ endif
+ END
+ v9.CheckDefSuccess(lines)
+
lines =<< trim END
d['key'] = 'asdf'
END
s/text/\=['aaa', 'bbb', 'ccc']/
assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$'))
bwipe!
+
+ # inside "if 0" substitute is ignored
+ if 0
+ s/a/\=nothing/ and | some more
+ endif
enddef
def Test_redir_to_var()
END
v9.CheckDefFailure(lines, 'E1089:')
+ lines =<< trim END
+ var text: string
+ redir => text
+ END
+ v9.CheckDefFailure(lines, 'E1185:')
+
lines =<< trim END
var ls = 'asdf'
redir => ls[1]
v9.CheckScriptFailure(lines, 'E476:')
enddef
+" The following messes up syntax highlight, keep near the end.
if has('python3')
+ def Test_python3_command()
+ py3 import vim
+ py3 vim.command("let g:done = 'yes'")
+ assert_equal('yes', g:done)
+ unlet g:done
+ enddef
+
def Test_python3_heredoc()
py3 << trim EOF
import vim
enddef
endif
-" This messes up syntax highlight, keep near the end.
if has('lua')
def Test_lua_heredoc()
g:d = {}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4395,
/**/
4394,
/**/
if (*eap->cmd == '[')
{
- // [var, var] = expr
+ // might be "[var, var] = expr"
*line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx);
if (*line == NULL)
return FAIL;
case CMD_decrement:
line = compile_assignment(p, &ea, ea.cmdidx, &cctx);
if (line == p)
+ {
+ emsg(_(e_invalid_assignment));
line = NULL;
+ }
break;
case CMD_unlet: