diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-06-27 12:32:57 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-06-27 12:32:57 +0200 |
commit | bd84617d1a6766efd59c94aabebb044bef805b99 (patch) | |
tree | 57fc315043f9e042b25d78e5c7ebd39ff5b3ad8d /src/testdir/test_lua.vim | |
parent | 7147820cb978f5b179cfec2f9d8b7774e28d43e0 (diff) |
patch 8.2.1066: Lua arrays are zero basedv8.2.1066
Problem: Lua arrays are zero based.
Solution: Make Lua arrays one based. (Prabir Shrestha, closes #6347)
Note: this is not backwards compatible.
Diffstat (limited to 'src/testdir/test_lua.vim')
-rw-r--r-- | src/testdir/test_lua.vim | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim index 826a7bce80..9d5ad6864e 100644 --- a/src/testdir/test_lua.vim +++ b/src/testdir/test_lua.vim @@ -327,8 +327,8 @@ func Test_lua_list() call assert_equal(7, luaeval('#l')) call assert_match('^list: \%(0x\)\?\x\+$', luaeval('tostring(l)')) - lua l[0] = 124 - lua l[5] = nil + lua l[1] = 124 + lua l[6] = nil lua l:insert('first') lua l:insert('xx', 3) call assert_equal(['first', 124, 'abc', 'xx', v:true, v:false, v:null, {'a': 1, 'b': 2, 'c': 3}], l) @@ -367,22 +367,22 @@ func Test_lua_recursive_list() lua l = vim.list():add(1):add(2) lua l = l:add(l) - call assert_equal(1, luaeval('l[0]')) - call assert_equal(2, luaeval('l[1]')) + call assert_equal(1, luaeval('l[1]')) + call assert_equal(2, luaeval('l[2]')) - call assert_equal(1, luaeval('l[2][0]')) - call assert_equal(2, luaeval('l[2][1]')) + call assert_equal(1, luaeval('l[3][1]')) + call assert_equal(2, luaeval('l[3][2]')) - call assert_equal(1, luaeval('l[2][2][0]')) - call assert_equal(2, luaeval('l[2][2][1]')) + call assert_equal(1, luaeval('l[3][3][1]')) + call assert_equal(2, luaeval('l[3][3][2]')) call assert_equal('[1, 2, [...]]', string(luaeval('l'))) call assert_match('^list: \%(0x\)\?\x\+$', luaeval('tostring(l)')) - call assert_equal(luaeval('tostring(l)'), luaeval('tostring(l[2])')) + call assert_equal(luaeval('tostring(l)'), luaeval('tostring(l[3])')) - call assert_equal(luaeval('l'), luaeval('l[2]')) - call assert_equal(luaeval('l'), luaeval('l[2][2]')) + call assert_equal(luaeval('l'), luaeval('l[3]')) + call assert_equal(luaeval('l'), luaeval('l[3][3]')) lua l = nil endfunc |