diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2021-08-31 23:49:43 +0100 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2021-10-03 20:06:33 +0100 |
commit | 86593beaa40035a10a664d3147327a01f4885cb7 (patch) | |
tree | 9a305c6bc4c1497bc9c40d38e059a6593c0d363b /src | |
parent | 59c8a1fd5158886cb13b56070ebf15259d12eba2 (diff) | |
download | rneovim-86593beaa40035a10a664d3147327a01f4885cb7.tar.gz rneovim-86593beaa40035a10a664d3147327a01f4885cb7.tar.bz2 rneovim-86593beaa40035a10a664d3147327a01f4885cb7.zip |
feat(eval/method): partially port v8.1.1954
Does not include listener_*() functions.
js_*() functions are N/A.
json_encode() and json_decode() didn't include tests; add some anyway
(to json_functions_spec.lua).
test_lua.vim isn't included yet, so add tests to luaeval_spec.lua.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.lua | 18 | ||||
-rw-r--r-- | src/nvim/testdir/test_arglist.vim | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_functions.vim | 10 | ||||
-rw-r--r-- | src/nvim/testdir/test_lispwords.vim | 3 | ||||
-rw-r--r-- | src/nvim/testdir/test_utf8.vim | 2 |
5 files changed, 19 insertions, 16 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua index f600b4ce06..572e32e5a7 100644 --- a/src/nvim/eval.lua +++ b/src/nvim/eval.lua @@ -220,21 +220,21 @@ return { jobstop={args=1}, jobwait={args={1, 2}}, join={args={1, 2}, base=1}, - json_decode={args=1}, - json_encode={args=1}, + json_decode={args=1, base=1}, + json_encode={args=1, base=1}, keys={args=1, base=1}, last_buffer_nr={}, -- obsolete len={args=1, base=1}, - libcall={args=3}, - libcallnr={args=3}, - line={args={1, 2}}, - line2byte={args=1}, - lispindent={args=1}, - list2str={args={1, 2}}, + libcall={args=3, base=3}, + libcallnr={args=3, base=3}, + line={args={1, 2}, base=1}, + line2byte={args=1, base=1}, + lispindent={args=1, base=1}, + list2str={args={1, 2}, base=1}, localtime={}, log={args=1, base=1, func="float_op_wrapper", data="&log"}, log10={args=1, base=1, func="float_op_wrapper", data="&log10"}, - luaeval={args={1, 2}}, + luaeval={args={1, 2}, base=1}, map={args=2, base=1}, maparg={args={1, 4}}, mapcheck={args={1, 3}}, diff --git a/src/nvim/testdir/test_arglist.vim b/src/nvim/testdir/test_arglist.vim index 01d8f32893..8fd60d6a5a 100644 --- a/src/nvim/testdir/test_arglist.vim +++ b/src/nvim/testdir/test_arglist.vim @@ -88,7 +88,7 @@ func Test_argadd_empty_curbuf() argadd Xargadd call assert_equal(curbuf, bufnr('%')) call assert_equal('', bufname('%')) - call assert_equal(1, line('$')) + call assert_equal(1, '$'->line()) rew call assert_notequal(curbuf, '%'->bufnr()) call assert_equal('Xargadd', '%'->bufname()) diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 90732549de..02e01497f9 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -905,7 +905,7 @@ func Test_byte2line_line2byte() call assert_equal([-1, -1, 1, 1, 2, 2, 2, 3, 3, -1], \ map(range(-1, 8), 'v:val->byte2line()')) call assert_equal([-1, -1, 1, 3, 6, 8, -1], - \ map(range(-1, 5), 'line2byte(v:val)')) + \ map(range(-1, 5), 'v:val->line2byte()')) set fileformat=dos call assert_equal([-1, -1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, -1], @@ -1505,17 +1505,17 @@ func Test_libcall_libcallnr() endif if has('win32') - call assert_equal($USERPROFILE, libcall(libc, 'getenv', 'USERPROFILE')) + call assert_equal($USERPROFILE, 'USERPROFILE'->libcall(libc, 'getenv')) else - call assert_equal($HOME, libcall(libc, 'getenv', 'HOME')) + call assert_equal($HOME, 'HOME'->libcall(libc, 'getenv')) endif " If function returns NULL, libcall() should return an empty string. call assert_equal('', libcall(libc, 'getenv', 'X_ENV_DOES_NOT_EXIT')) " Test libcallnr() with string and integer argument. - call assert_equal(4, libcallnr(libc, 'strlen', 'abcd')) - call assert_equal(char2nr('A'), libcallnr(libc, 'toupper', char2nr('a'))) + call assert_equal(4, 'abcd'->libcallnr(libc, 'strlen')) + call assert_equal(char2nr('A'), char2nr('a')->libcallnr(libc, 'toupper')) call assert_fails("call libcall(libc, 'Xdoesnotexist_', '')", 'E364:') call assert_fails("call libcallnr(libc, 'Xdoesnotexist_', '')", 'E364:') diff --git a/src/nvim/testdir/test_lispwords.vim b/src/nvim/testdir/test_lispwords.vim index 4c05504cf1..aa5a738bdf 100644 --- a/src/nvim/testdir/test_lispwords.vim +++ b/src/nvim/testdir/test_lispwords.vim @@ -43,6 +43,9 @@ func Test_lisp_indent() \ ',@body', \ '(princ "</a>")))' \ ]) + call assert_equal(7, lispindent(2)) + call assert_equal(5, 6->lispindent()) + set lisp set lispwords& let save_copt = &cpoptions diff --git a/src/nvim/testdir/test_utf8.vim b/src/nvim/testdir/test_utf8.vim index 735efac36d..da72da087f 100644 --- a/src/nvim/testdir/test_utf8.vim +++ b/src/nvim/testdir/test_utf8.vim @@ -111,7 +111,7 @@ func Test_list2str_str2list_utf8() let s = "\u304b\u3099\u3044" let l = [0x304b, 0x3099, 0x3044] call assert_equal(l, str2list(s, 1)) - call assert_equal(s, list2str(l, 1)) + call assert_equal(s, l->list2str(1)) if &enc ==# 'utf-8' call assert_equal(str2list(s), str2list(s, 1)) call assert_equal(list2str(l), list2str(l, 1)) |