Mercurial > vim
comparison src/testdir/test_listdict.vim @ 25593:c6277019b8c1 v8.2.3333
patch 8.2.3333: Vim9: not enough tests run with Vim9
Commit: https://github.com/vim/vim/commit/3e9c0b9608736e7d888f3141443f8754143364d7
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 12 10:39:10 2021 +0200
patch 8.2.3333: 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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 12 Aug 2021 10:45:02 +0200 |
parents | ea69398b40d1 |
children | c4e29355cd8b |
comparison
equal
deleted
inserted
replaced
25592:9d0e0092096b | 25593:c6277019b8c1 |
---|---|
455 func d.func(a) | 455 func d.func(a) |
456 return "a:" . a:a | 456 return "a:" . a:a |
457 endfunc | 457 endfunc |
458 let expected = 'a:' . string(get(d, 'func')) | 458 let expected = 'a:' . string(get(d, 'func')) |
459 call assert_equal(expected, d.func(string(remove(d, 'func')))) | 459 call assert_equal(expected, d.func(string(remove(d, 'func')))) |
460 | |
461 " similar, in a way it also works in Vim9 | |
462 let lines =<< trim END | |
463 VAR d = {1: 1, 2: 'x'} | |
464 func GetArg(a) | |
465 return "a:" .. a:a | |
466 endfunc | |
467 LET d.func = function('GetArg') | |
468 VAR expected = 'a:' .. string(get(d, 'func')) | |
469 call assert_equal(expected, d.func(string(remove(d, 'func')))) | |
470 END | |
471 call CheckTransLegacySuccess(lines) | |
472 call CheckTransVim9Success(lines) | |
460 endfunc | 473 endfunc |
461 | 474 |
462 func Test_dict_literal_keys() | 475 func Test_dict_literal_keys() |
463 call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, #{one: 1, two2: 2, 3three: 3, 44: 4},) | 476 call assert_equal({'one': 1, 'two2': 2, '3three': 3, '44': 4}, #{one: 1, two2: 2, 3three: 3, 44: 4},) |
464 | 477 |