def Test_expr7_parens()
# (expr)
- assert_equal(4, (6 * 4) / 6)
- assert_equal(0, 6 * ( 4 / 6 ))
-
- assert_equal(6, +6)
- assert_equal(-6, -6)
- assert_equal(false, !-3)
- assert_equal(true, !+0)
-enddef
-
-def Test_expr7_parens_vim9script()
var lines =<< trim END
- vim9script
+ assert_equal(4, (6 * 4) / 6)
+ assert_equal(0, 6 * ( 4 / 6 ))
+
+ assert_equal(6, +6)
+ assert_equal(-6, -6)
+ assert_equal(false, !-3)
+ assert_equal(true, !+0)
+
+ assert_equal(7, 5 + (
+ 2))
+ assert_equal(7, 5 + (
+ 2
+ ))
+ assert_equal(7, 5 + ( # comment
+ 2))
+ assert_equal(7, 5 + ( # comment
+ # comment
+ 2))
+
var s = (
'one'
..
)
assert_equal('onetwo', s)
END
- CheckScriptSuccess(lines)
+ CheckDefAndScriptSuccess(lines)
enddef
def Test_expr7_negate_add()
compile_parenthesis(char_u **arg, cctx_T *cctx, ppconst_T *ppconst)
{
int ret;
+ char_u *p = *arg + 1;
- *arg = skipwhite(*arg + 1);
+ if (may_get_next_line_error(p, arg, cctx) == FAIL)
+ return FAIL;
if (ppconst->pp_used <= PPSIZE - 10)
{
ret = compile_expr1(arg, cctx, ppconst);