diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-19 08:03:13 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-19 08:03:13 +0800 |
commit | f8669e8a181abad98229d97439a9cafe8c32fc06 (patch) | |
tree | 14f7d4072f058b5a96cb6f517276b2e40aaaa8ca /test/functional | |
parent | 42d5142367c375be5cbdfbf11d150a5ebe8c30d6 (diff) | |
download | rneovim-f8669e8a181abad98229d97439a9cafe8c32fc06.tar.gz rneovim-f8669e8a181abad98229d97439a9cafe8c32fc06.tar.bz2 rneovim-f8669e8a181abad98229d97439a9cafe8c32fc06.zip |
vim-patch:8.2.1698: cannot lock a variable in legacy Vim script like in Vim9 (#21883)
Problem: Cannot lock a variable in legacy Vim script like in Vim9.
Solution: Make ":lockvar 0" work.
https://github.com/vim/vim/commit/a187c43cfe8863d48b2159d695fedcb71f8525c1
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/legacy/055_list_and_dict_types_spec.lua | 232 |
1 files changed, 0 insertions, 232 deletions
diff --git a/test/functional/legacy/055_list_and_dict_types_spec.lua b/test/functional/legacy/055_list_and_dict_types_spec.lua index c0ff3ed17a..75294b3786 100644 --- a/test/functional/legacy/055_list_and_dict_types_spec.lua +++ b/test/functional/legacy/055_list_and_dict_types_spec.lua @@ -330,214 +330,6 @@ describe('list and dictionary types', function() same list: 1]]) end) - it('locked variables (part 1)', function() - source([=[ - let l = [] - for depth in range(5) - $put ='depth is ' . depth - for u in range(3) - unlet l - let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] - exe "lockvar " . depth . " l" - if u == 1 - exe "unlockvar l" - elseif u == 2 - exe "unlockvar " . depth . " l" - endif - let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") . - \ islocked("l[1][1][0]") . '-' . islocked("l[2]") . - \ islocked("l[2]['6']") . islocked("l[2]['6'][7]") - $put =ps - let ps = '' - try - let l[1][1][0] = 99 - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - let l[1][1] = [99] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - let l[1] = [99] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - let l[2]['6'][7] = 99 - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - let l[2][6] = {99: 99} - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - let l[2] = {99: 99} - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - let l = [99] - let ps .= 'p' - catch - let ps .= 'F' - endtry - $put =ps - endfor - endfor]=]) - expect([[ - - depth is 0 - 0000-000 - ppppppp - 0000-000 - ppppppp - 0000-000 - ppppppp - depth is 1 - 1000-000 - ppppppF - 0000-000 - ppppppp - 0000-000 - ppppppp - depth is 2 - 1100-100 - ppFppFF - 0000-000 - ppppppp - 0000-000 - ppppppp - depth is 3 - 1110-110 - pFFpFFF - 0010-010 - pFppFpp - 0000-000 - ppppppp - depth is 4 - 1111-111 - FFFFFFF - 0011-011 - FFpFFpp - 0000-000 - ppppppp]]) - end) - - -- TODO In the original test the 5th line of this source() call was used. - -- But now the test only passes if I comment it. - it('unletting locked variables', function() - source([=[ - let l = [] - for depth in range(5) - $put ='depth is ' . depth - for u in range(3) - "unlet l - let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] - exe "lockvar " . depth . " l" - if u == 1 - exe "unlockvar l" - elseif u == 2 - exe "unlockvar " . depth . " l" - endif - let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") . - \ islocked("l[1][1][0]") . '-' . islocked("l[2]") . - \ islocked("l[2]['6']") . islocked("l[2]['6'][7]") - $put =ps - let ps = '' - try - unlet l[2]['6'][7] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - unlet l[2][6] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - unlet l[2] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - unlet l[1][1][0] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - unlet l[1][1] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - unlet l[1] - let ps .= 'p' - catch - let ps .= 'F' - endtry - try - unlet l - let ps .= 'p' - catch - let ps .= 'F' - endtry - $put =ps - endfor - endfor]=]) - expect([[ - - depth is 0 - 0000-000 - ppppppp - 0000-000 - ppppppp - 0000-000 - ppppppp - depth is 1 - 1000-000 - ppFppFp - 0000-000 - ppppppp - 0000-000 - ppppppp - depth is 2 - 1100-100 - pFFpFFp - 0000-000 - ppppppp - 0000-000 - ppppppp - depth is 3 - 1110-110 - FFFFFFp - 0010-010 - FppFppp - 0000-000 - ppppppp - depth is 4 - 1111-111 - FFFFFFp - 0011-011 - FppFppp - 0000-000 - ppppppp]]) - end) - it('locked variables and :unlet or list / dict functions', function() source([[ $put ='Locks and commands or functions:' @@ -676,30 +468,6 @@ describe('list and dictionary types', function() ['a', 'b', 3]]=]) end) - it('locked variables (part 2)', function() - feed_command( - 'let l = [1, 2, 3, 4]', - 'lockvar! l', - '$put =string(l)', - 'unlockvar l[1]', - 'unlet l[0:1]', - '$put =string(l)', - 'unlet l[1:2]', - '$put =string(l)', - 'unlockvar l[1]', - 'let l[0:1] = [0, 1]', - '$put =string(l)', - 'let l[1:2] = [0, 1]', - '$put =string(l)') - expect([=[ - - [1, 2, 3, 4] - [1, 2, 3, 4] - [1, 2, 3, 4] - [1, 2, 3, 4] - [1, 2, 3, 4]]=]) - end) - it(':lockvar/islocked() triggering script autoloading.', function() source([[ set rtp+=test/functional/fixtures |