garray_T *gap = &evalarg->eval_ga;
char_u *line;
- if (arg != NULL && *arg == NL)
- return skipwhite(arg + 1);
+ if (arg != NULL)
+ {
+ if (*arg == NL)
+ return skipwhite(arg + 1);
+ // Truncate before a trailing comment, so that concatenating the lines
+ // won't turn the rest into a comment.
+ if (*skipwhite(arg) == '#')
+ *arg = NUL;
+ }
if (evalarg->eval_cookie != NULL)
line = evalarg->eval_getline(0, evalarg->eval_cookie, 0,
exe 'sleep ' .. [20, 100, 500, 500, 500][g:run_nr] .. 'm'
call assert_equal('done', g:result)
unlet g:result
+
+ let lines =<< trim END
+ g:result = [0]->map((_, v) =>
+ 1 # inline comment
+ +
+ 2
+ )
+ assert_equal([3], g:result)
+ END
+ call v9.CheckDefAndScriptSuccess(lines)
endfunc
func Test_lambda_with_partial()