Mercurial > vim
comparison src/testdir/test_vim9_cmd.vim @ 23072:4b398a229b0b v8.2.2082
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Commit: https://github.com/vim/vim/commit/e0de171ecd2ff7acd56deda2cf81f0d13a69c803
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 2 17:36:54 2020 +0100
patch 8.2.2082: Vim9: can still use the depricated #{} dict syntax
Problem: Vim9: can still use the depricated #{} dict syntax.
Solution: Remove support for #{} in Vim9 script. (closes https://github.com/vim/vim/issues/7406, closes https://github.com/vim/vim/issues/7405)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 02 Dec 2020 17:45:05 +0100 |
parents | ec23d84a096d |
children | b6aadb0b3a56 |
comparison
equal
deleted
inserted
replaced
23071:20dac5998fa6 | 23072:4b398a229b0b |
---|---|
249 ->map({ -> 0}) | 249 ->map({ -> 0}) |
250 endif | 250 endif |
251 enddef | 251 enddef |
252 | 252 |
253 def Test_dict_member() | 253 def Test_dict_member() |
254 var test: dict<list<number>> = {'data': [3, 1, 2]} | 254 var test: dict<list<number>> = {data: [3, 1, 2]} |
255 test.data->sort() | 255 test.data->sort() |
256 assert_equal(#{data: [1, 2, 3]}, test) | 256 assert_equal({data: [1, 2, 3]}, test) |
257 test.data | 257 test.data |
258 ->reverse() | 258 ->reverse() |
259 assert_equal(#{data: [3, 2, 1]}, test) | 259 assert_equal({data: [3, 2, 1]}, test) |
260 | 260 |
261 var lines =<< trim END | 261 var lines =<< trim END |
262 vim9script | 262 vim9script |
263 var test: dict<list<number>> = {'data': [3, 1, 2]} | 263 var test: dict<list<number>> = {data: [3, 1, 2]} |
264 test.data->sort() | 264 test.data->sort() |
265 assert_equal(#{data: [1, 2, 3]}, test) | 265 assert_equal({data: [1, 2, 3]}, test) |
266 END | 266 END |
267 CheckScriptSuccess(lines) | 267 CheckScriptSuccess(lines) |
268 enddef | 268 enddef |
269 | 269 |
270 def Test_bar_after_command() | 270 def Test_bar_after_command() |
306 delete('Xoutfile') | 306 delete('Xoutfile') |
307 endif | 307 endif |
308 enddef | 308 enddef |
309 | 309 |
310 def Test_filter_is_not_modifier() | 310 def Test_filter_is_not_modifier() |
311 var tags = [{'a': 1, 'b': 2}, {'x': 3, 'y': 4}] | 311 var tags = [{a: 1, b: 2}, {x: 3, y: 4}] |
312 filter(tags, { _, v -> has_key(v, 'x') ? 1 : 0 }) | 312 filter(tags, { _, v -> has_key(v, 'x') ? 1 : 0 }) |
313 assert_equal([#{x: 3, y: 4}], tags) | 313 assert_equal([{x: 3, y: 4}], tags) |
314 enddef | 314 enddef |
315 | 315 |
316 def Test_command_modifier_filter() | 316 def Test_command_modifier_filter() |
317 var lines =<< trim END | 317 var lines =<< trim END |
318 final expected = "\nType Name Content\n c \"c piyo" | 318 final expected = "\nType Name Content\n c \"c piyo" |