Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 27901:dd7d94b911fa v8.2.4476
patch 8.2.4476: operator name spelled wrong
Commit: https://github.com/vim/vim/commit/e41c1dd8890d3f701253255993f4e9af2d12225c
Author: =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>
Date: Sat Feb 26 11:46:13 2022 +0000
patch 8.2.4476: operator name spelled wrong
Problem: Operator name spelled wrong.
Solution: Change trinary to ternary. (Goc Dundar, closes https://github.com/vim/vim/issues/9850)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Feb 2022 13:00:04 +0100 |
parents | b081ba78675a |
children | 7d70b420de00 |
comparison
equal
deleted
inserted
replaced
27900:b39a350da22f | 27901:dd7d94b911fa |
---|---|
10 def FuncTwo(arg: number): number | 10 def FuncTwo(arg: number): number |
11 return 123 | 11 return 123 |
12 enddef | 12 enddef |
13 | 13 |
14 " test cond ? expr : expr | 14 " test cond ? expr : expr |
15 def Test_expr1_trinary() | 15 def Test_expr1_ternary() |
16 var lines =<< trim END | 16 var lines =<< trim END |
17 assert_equal('one', true ? 'one' : 'two') | 17 assert_equal('one', true ? 'one' : 'two') |
18 assert_equal('one', 1 ? | 18 assert_equal('one', 1 ? |
19 'one' : | 19 'one' : |
20 'two') | 20 'two') |
72 var Z = g:cond ? FuncOne : FuncTwo | 72 var Z = g:cond ? FuncOne : FuncTwo |
73 END | 73 END |
74 v9.CheckDefAndScriptFailure(lines, ['E1001: Variable not found: FuncOne', 'E121: Undefined variable: FuncTwo']) | 74 v9.CheckDefAndScriptFailure(lines, ['E1001: Variable not found: FuncOne', 'E121: Undefined variable: FuncTwo']) |
75 enddef | 75 enddef |
76 | 76 |
77 def Test_expr1_trinary_vimscript() | 77 def Test_expr1_ternary_vimscript() |
78 # check line continuation | 78 # check line continuation |
79 var lines =<< trim END | 79 var lines =<< trim END |
80 var name = 1 | 80 var name = 1 |
81 ? 'yes' | 81 ? 'yes' |
82 : 'no' | 82 : 'no' |
168 assert_equal(v:true, eval(string(v:true))) | 168 assert_equal(v:true, eval(string(v:true))) |
169 END | 169 END |
170 v9.CheckDefAndScriptSuccess(lines) | 170 v9.CheckDefAndScriptSuccess(lines) |
171 enddef | 171 enddef |
172 | 172 |
173 func Test_expr1_trinary_fails() | 173 func Test_expr1_ternary_fails() |
174 call v9.CheckDefAndScriptFailure(["var x = 1 ? 'one'"], "Missing ':' after '?'", 1) | 174 call v9.CheckDefAndScriptFailure(["var x = 1 ? 'one'"], "Missing ':' after '?'", 1) |
175 | 175 |
176 let msg = "White space required before and after '?'" | 176 let msg = "White space required before and after '?'" |
177 call v9.CheckDefAndScriptFailure(["var x = 1? 'one' : 'two'"], msg, 1) | 177 call v9.CheckDefAndScriptFailure(["var x = 1? 'one' : 'two'"], msg, 1) |
178 call v9.CheckDefAndScriptFailure(["var x = 1 ?'one' : 'two'"], msg, 1) | 178 call v9.CheckDefAndScriptFailure(["var x = 1 ?'one' : 'two'"], msg, 1) |