comparison src/testdir/test_vim9_script.vim @ 22274:1634ca41e4d3 v8.2.1686

patch 8.2.1686: Vim9: "const!" not sufficiently tested Commit: https://github.com/vim/vim/commit/71abe4828974af495602ffaff63cf643a16de84b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 14 22:28:30 2020 +0200 patch 8.2.1686: Vim9: "const!" not sufficiently tested Problem: Vim9: "const!" not sufficiently tested. Solution: Add a few more test cases. Fix type checking.
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Sep 2020 22:30:03 +0200
parents eb1f5f618c75
children 6b385c2b9ff5
comparison
equal deleted inserted replaced
22273:51375bedaefe 22274:1634ca41e4d3
829 const list = [1, 2, 3] 829 const list = [1, 2, 3]
830 list[0] = 4 830 list[0] = 4
831 list->assert_equal([4, 2, 3]) 831 list->assert_equal([4, 2, 3])
832 const! other = [5, 6, 7] 832 const! other = [5, 6, 7]
833 other->assert_equal([5, 6, 7]) 833 other->assert_equal([5, 6, 7])
834
835 let varlist = [7, 8]
836 const! constlist = [1, varlist, 3]
837 varlist[0] = 77
838 # TODO: does not work yet
839 # constlist[1][1] = 88
840 let cl = constlist[1]
841 cl[1] = 88
842 constlist->assert_equal([1, [77, 88], 3])
843
844 let vardict = #{five: 5, six: 6}
845 const! constdict = #{one: 1, two: vardict, three: 3}
846 vardict['five'] = 55
847 # TODO: does not work yet
848 # constdict['two']['six'] = 66
849 let cd = constdict['two']
850 cd['six'] = 66
851 constdict->assert_equal(#{one: 1, two: #{five: 55, six: 66}, three: 3})
834 END 852 END
835 CheckDefAndScriptSuccess(lines) 853 CheckDefAndScriptSuccess(lines)
836 enddef 854 enddef
837 855
838 def Test_const_bang() 856 def Test_const_bang()