Mercurial > vim
diff src/testdir/test_vim9_expr.vim @ 21022:9d8634e91d1b v8.2.1062
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Commit: https://github.com/vim/vim/commit/793648fb563359396a23740c72a6e04cb64df3a9
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 26 21:28:25 2020 +0200
patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"
Problem: Vim9: no line break allowed inside "cond ? val1 : val2".
Solution: Check for operator after line break.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 26 Jun 2020 21:30:06 +0200 |
parents | 7ee565134d4a |
children | 02b03915855d |
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -45,6 +45,27 @@ def Test_expr1() assert_equal(function('len'), RetThat) enddef +def Test_expr1_vimscript() + " only checks line continuation + let lines =<< trim END + vim9script + let var = 1 + ? 'yes' + : 'no' + assert_equal('yes', var) + END + CheckScriptSuccess(lines) + + lines =<< trim END + vim9script + let var = v:false + ? 'yes' + : 'no' + assert_equal('no', var) + END + CheckScriptSuccess(lines) +enddef + func Test_expr1_fails() call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'") call CheckDefFailure(["let x = 1 ? 'one' : xxx"], "E1001:")