Mercurial > vim
comparison src/testdir/test_vim9_builtin.vim @ 29978:34151eb6ae25 v9.0.0327
patch 9.0.0327: items() does not work on a list
Commit: https://github.com/vim/vim/commit/976f859763b215050a03248dbc2bb62fa5d0d059
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 30 14:34:52 2022 +0100
patch 9.0.0327: items() does not work on a list
Problem: items() does not work on a list. (Sergey Vlasov)
Solution: Make items() work on a list. (closes https://github.com/vim/vim/issues/11013)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Aug 2022 15:45:03 +0200 |
parents | cd573d7bc30d |
children | 0ad8b72af148 |
comparison
equal
deleted
inserted
replaced
29977:b6c19db0298b | 29978:34151eb6ae25 |
---|---|
2242 unlet g:v1 | 2242 unlet g:v1 |
2243 islocked('')->assert_equal(-1) | 2243 islocked('')->assert_equal(-1) |
2244 enddef | 2244 enddef |
2245 | 2245 |
2246 def Test_items() | 2246 def Test_items() |
2247 v9.CheckDefFailure(['[]->items()'], 'E1013: Argument 1: type mismatch, expected dict<any> but got list<unknown>') | 2247 v9.CheckDefFailure(['"x"->items()'], 'E1013: Argument 1: type mismatch, expected list<any> but got string') |
2248 assert_equal([['a', 10], ['b', 20]], {'a': 10, 'b': 20}->items()) | 2248 assert_equal([['a', 10], ['b', 20]], {'a': 10, 'b': 20}->items()) |
2249 assert_equal([], {}->items()) | 2249 assert_equal([], {}->items()) |
2250 assert_equal(['x', 'x'], {'a': 10, 'b': 20}->items()->map((_, _) => 'x')) | 2250 assert_equal(['x', 'x'], {'a': 10, 'b': 20}->items()->map((_, _) => 'x')) |
2251 | |
2252 assert_equal([[0, 'a'], [1, 'b']], ['a', 'b']->items()) | |
2253 assert_equal([], []->items()) | |
2254 assert_equal([], test_null_list()->items()) | |
2251 enddef | 2255 enddef |
2252 | 2256 |
2253 def Test_job_getchannel() | 2257 def Test_job_getchannel() |
2254 if !has('job') | 2258 if !has('job') |
2255 CheckFeature job | 2259 CheckFeature job |