0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1529: Vim9: :elseif may be compiled when not needed

Problem:    Vim9: :elseif may be compiled when not needed.
Solution:   Do evaluate the :elseif expression.
This commit is contained in:
Bram Moolenaar
2020-08-27 23:08:47 +02:00
parent 3988f64f9d
commit 749639ec72
3 changed files with 9 additions and 1 deletions

View File

@@ -43,6 +43,9 @@ def Test_expr1()
var = 0
assert_equal('two', var ? 'one' : 'two')
# with constant condition expression is not evaluated
assert_equal('one', 1 ? 'one' : xxx)
let Some: func = function('len')
let Other: func = function('winnr')
let Res: func = g:atrue ? Some : Other
@@ -139,7 +142,6 @@ enddef
func Test_expr1_fails()
call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'", 1)
call CheckDefFailure(["let x = 1 ? 'one' : xxx"], "E1001:", 1)
let msg = "white space required before and after '?'"
call CheckDefFailure(["let x = 1? 'one' : 'two'"], msg, 1)