Mercurial > vim
comparison src/testdir/vim9.vim @ 25597:0fdacd8f0cf3 v8.2.3335
patch 8.2.3335: Vim9: not enough tests run with Vim9
Commit: https://github.com/vim/vim/commit/ef98257593a0abf1300d0f70358dc45a70a62580
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 12 19:27:57 2021 +0200
patch 8.2.3335: Vim9: not enough tests run with Vim9
Problem: Vim9: not enough tests run with Vim9.
Solution: Run a few more tests in Vim9 script and :def function. Fix that
items(), keys() and values9) return zero for a NULL dict.
Make join() return an empty string for a NULL list. Make sort()
return an empty list for a NULL list.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 12 Aug 2021 19:30:03 +0200 |
parents | c6277019b8c1 |
children | f8bcd21e6e24 |
comparison
equal
deleted
inserted
replaced
25596:15ce187b41b8 | 25597:0fdacd8f0cf3 |
---|---|
170 " CheckLegacyAndVim9Success() | 170 " CheckLegacyAndVim9Success() |
171 def CheckTransLegacySuccess(lines: list<string>) | 171 def CheckTransLegacySuccess(lines: list<string>) |
172 var legacylines = lines->mapnew((_, v) => | 172 var legacylines = lines->mapnew((_, v) => |
173 v->substitute('\<VAR\>', 'let', 'g') | 173 v->substitute('\<VAR\>', 'let', 'g') |
174 ->substitute('\<LET\>', 'let', 'g') | 174 ->substitute('\<LET\>', 'let', 'g') |
175 ->substitute('\<LSTART\>', '{', 'g') | |
176 ->substitute('\<LMIDDLE\>', '->', 'g') | |
177 ->substitute('\<LEND\>', '}', 'g') | |
175 ->substitute('#"', ' "', 'g')) | 178 ->substitute('#"', ' "', 'g')) |
176 CheckLegacySuccess(legacylines) | 179 CheckLegacySuccess(legacylines) |
177 enddef | 180 enddef |
178 | 181 |
179 " Execute "lines" in a :def function, translated as in | 182 " Execute "lines" in a :def function, translated as in |
180 " CheckLegacyAndVim9Success() | 183 " CheckLegacyAndVim9Success() |
181 def CheckTransDefSuccess(lines: list<string>) | 184 def CheckTransDefSuccess(lines: list<string>) |
182 var vim9lines = lines->mapnew((_, v) => | 185 var vim9lines = lines->mapnew((_, v) => |
183 v->substitute('\<VAR\>', 'var', 'g') | 186 v->substitute('\<VAR\>', 'var', 'g') |
184 ->substitute('\<LET ', '', 'g')) | 187 ->substitute('\<LET ', '', 'g') |
188 ->substitute('\<LSTART\>', '(', 'g') | |
189 ->substitute('\<LMIDDLE\>', ') =>', 'g') | |
190 ->substitute(' *\<LEND\> *', '', 'g')) | |
185 CheckDefSuccess(vim9lines) | 191 CheckDefSuccess(vim9lines) |
186 enddef | 192 enddef |
187 | 193 |
188 " Execute "lines" in a Vim9 script, translated as in | 194 " Execute "lines" in a Vim9 script, translated as in |
189 " CheckLegacyAndVim9Success() | 195 " CheckLegacyAndVim9Success() |
190 def CheckTransVim9Success(lines: list<string>) | 196 def CheckTransVim9Success(lines: list<string>) |
191 var vim9lines = lines->mapnew((_, v) => | 197 var vim9lines = lines->mapnew((_, v) => |
192 v->substitute('\<VAR\>', 'var', 'g') | 198 v->substitute('\<VAR\>', 'var', 'g') |
193 ->substitute('\<LET ', '', 'g')) | 199 ->substitute('\<LET ', '', 'g') |
200 ->substitute('\<LSTART\>', '(', 'g') | |
201 ->substitute('\<LMIDDLE\>', ') =>', 'g') | |
202 ->substitute(' *\<LEND\> *', '', 'g')) | |
194 CheckScriptSuccess(['vim9script'] + vim9lines) | 203 CheckScriptSuccess(['vim9script'] + vim9lines) |
195 enddef | 204 enddef |
196 | 205 |
197 " Execute "lines" in a legacy function, :def function and Vim9 script. | 206 " Execute "lines" in a legacy function, :def function and Vim9 script. |
198 " Use 'VAR' for a declaration. | 207 " Use 'VAR' for a declaration. |
199 " Use 'LET' for an assignment | 208 " Use 'LET' for an assignment |
200 " Use ' #"' for a comment | 209 " Use ' #"' for a comment |
210 " Use LSTART arg LMIDDLE expr LEND for lambda | |
201 def CheckLegacyAndVim9Success(lines: list<string>) | 211 def CheckLegacyAndVim9Success(lines: list<string>) |
202 CheckTransLegacySuccess(lines) | 212 CheckTransLegacySuccess(lines) |
203 CheckTransDefSuccess(lines) | 213 CheckTransDefSuccess(lines) |
204 CheckTransVim9Success(lines) | 214 CheckTransVim9Success(lines) |
205 enddef | 215 enddef |