diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 17:59:57 +0000 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2024-01-12 18:59:14 +0000 |
commit | 795f896a5772d5e0795f86642bdf90c82efac45c (patch) | |
tree | 308f04fbee18d2ec3f00c12a8bec96b84d8907f0 /test/functional/ex_cmds/echo_spec.lua | |
parent | 4f81f506f96f8b5bfcf00e952ceb492d3ce9dc6e (diff) | |
download | rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.tar.gz rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.tar.bz2 rneovim-795f896a5772d5e0795f86642bdf90c82efac45c.zip |
test: rename (meths, funcs) -> (api, fn)
Diffstat (limited to 'test/functional/ex_cmds/echo_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/echo_spec.lua | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/test/functional/ex_cmds/echo_spec.lua b/test/functional/ex_cmds/echo_spec.lua index bfc8f57632..e9176a6204 100644 --- a/test/functional/ex_cmds/echo_spec.lua +++ b/test/functional/ex_cmds/echo_spec.lua @@ -4,8 +4,8 @@ local eq = helpers.eq local NIL = vim.NIL local eval = helpers.eval local clear = helpers.clear -local meths = helpers.meths -local funcs = helpers.funcs +local api = helpers.api +local fn = helpers.fn local source = helpers.source local dedent = helpers.dedent local command = helpers.command @@ -17,12 +17,12 @@ describe(':echo :echon :echomsg :echoerr', function() local fn_tbl = { 'String', 'StringN', 'StringMsg', 'StringErr' } local function assert_same_echo_dump(expected, input, use_eval) for _, v in pairs(fn_tbl) do - eq(expected, use_eval and eval(v .. '(' .. input .. ')') or funcs[v](input)) + eq(expected, use_eval and eval(v .. '(' .. input .. ')') or fn[v](input)) end end local function assert_matches_echo_dump(expected, input, use_eval) for _, v in pairs(fn_tbl) do - matches(expected, use_eval and eval(v .. '(' .. input .. ')') or funcs[v](input)) + matches(expected, use_eval and eval(v .. '(' .. input .. ')') or fn[v](input)) end end @@ -68,21 +68,21 @@ describe(':echo :echon :echomsg :echoerr', function() eq('v:true', eval('String(v:true)')) eq('v:false', eval('String(v:false)')) eq('v:null', eval('String(v:null)')) - eq('v:true', funcs.String(true)) - eq('v:false', funcs.String(false)) - eq('v:null', funcs.String(NIL)) + eq('v:true', fn.String(true)) + eq('v:false', fn.String(false)) + eq('v:null', fn.String(NIL)) eq('v:true', eval('StringMsg(v:true)')) eq('v:false', eval('StringMsg(v:false)')) eq('v:null', eval('StringMsg(v:null)')) - eq('v:true', funcs.StringMsg(true)) - eq('v:false', funcs.StringMsg(false)) - eq('v:null', funcs.StringMsg(NIL)) + eq('v:true', fn.StringMsg(true)) + eq('v:false', fn.StringMsg(false)) + eq('v:null', fn.StringMsg(NIL)) eq('v:true', eval('StringErr(v:true)')) eq('v:false', eval('StringErr(v:false)')) eq('v:null', eval('StringErr(v:null)')) - eq('v:true', funcs.StringErr(true)) - eq('v:false', funcs.StringErr(false)) - eq('v:null', funcs.StringErr(NIL)) + eq('v:true', fn.StringErr(true)) + eq('v:false', fn.StringErr(false)) + eq('v:null', fn.StringErr(NIL)) end) it('dumps values with at most six digits after the decimal point', function() @@ -223,7 +223,7 @@ describe(':echo :echon :echomsg :echoerr', function() end) it('does not crash or halt when dumping partials with reference cycles in self', function() - meths.nvim_set_var('d', { v = true }) + api.nvim_set_var('d', { v = true }) eq( dedent( [[ @@ -251,7 +251,7 @@ describe(':echo :echon :echomsg :echoerr', function() end) it('does not crash or halt when dumping partials with reference cycles in arguments', function() - meths.nvim_set_var('l', {}) + api.nvim_set_var('l', {}) eval('add(l, l)') -- Regression: the below line used to crash (add returns original list and -- there was error in dumping partials). Tested explicitly in @@ -269,8 +269,8 @@ describe(':echo :echon :echomsg :echoerr', function() it( 'does not crash or halt when dumping partials with reference cycles in self and arguments', function() - meths.nvim_set_var('d', { v = true }) - meths.nvim_set_var('l', {}) + api.nvim_set_var('d', { v = true }) + api.nvim_set_var('l', {}) eval('add(l, l)') eval('add(l, function("Test1", l))') eval('add(l, function("Test1", d))') @@ -305,13 +305,13 @@ describe(':echo :echon :echomsg :echoerr', function() end) it('does not error when dumping recursive lists', function() - meths.nvim_set_var('l', {}) + api.nvim_set_var('l', {}) eval('add(l, l)') eq(0, exc_exec('echo String(l)')) end) it('dumps recursive lists without error', function() - meths.nvim_set_var('l', {}) + api.nvim_set_var('l', {}) eval('add(l, l)') eq('[[...@0]]', exec_capture('echo String(l)')) eq('[[[...@1]]]', exec_capture('echo String([l])')) @@ -335,13 +335,13 @@ describe(':echo :echon :echomsg :echoerr', function() end) it('does not error when dumping recursive dictionaries', function() - meths.nvim_set_var('d', { d = 1 }) + api.nvim_set_var('d', { d = 1 }) eval('extend(d, {"d": d})') eq(0, exc_exec('echo String(d)')) end) it('dumps recursive dictionaries without the error', function() - meths.nvim_set_var('d', { d = 1 }) + api.nvim_set_var('d', { d = 1 }) eval('extend(d, {"d": d})') eq("{'d': {...@0}}", exec_capture('echo String(d)')) eq("{'out': {'d': {...@1}}}", exec_capture('echo String({"out": d})')) @@ -358,43 +358,43 @@ describe(':echo :echon :echomsg :echoerr', function() it('displays hex as hex', function() -- Regression: due to missing (uint8_t) cast \x80 was represented as -- ~@<80>. - eq('<80>', funcs.String(chr(0x80))) - eq('<81>', funcs.String(chr(0x81))) - eq('<8e>', funcs.String(chr(0x8e))) - eq('<c2>', funcs.String(('«'):sub(1, 1))) - eq('«', funcs.String(('«'):sub(1, 2))) - - eq('<80>', funcs.StringMsg(chr(0x80))) - eq('<81>', funcs.StringMsg(chr(0x81))) - eq('<8e>', funcs.StringMsg(chr(0x8e))) - eq('<c2>', funcs.StringMsg(('«'):sub(1, 1))) - eq('«', funcs.StringMsg(('«'):sub(1, 2))) + eq('<80>', fn.String(chr(0x80))) + eq('<81>', fn.String(chr(0x81))) + eq('<8e>', fn.String(chr(0x8e))) + eq('<c2>', fn.String(('«'):sub(1, 1))) + eq('«', fn.String(('«'):sub(1, 2))) + + eq('<80>', fn.StringMsg(chr(0x80))) + eq('<81>', fn.StringMsg(chr(0x81))) + eq('<8e>', fn.StringMsg(chr(0x8e))) + eq('<c2>', fn.StringMsg(('«'):sub(1, 1))) + eq('«', fn.StringMsg(('«'):sub(1, 2))) end) it('displays ASCII control characters using ^X notation', function() - eq('^C', funcs.String(ctrl('c'))) - eq('^A', funcs.String(ctrl('a'))) - eq('^F', funcs.String(ctrl('f'))) - eq('^C', funcs.StringMsg(ctrl('c'))) - eq('^A', funcs.StringMsg(ctrl('a'))) - eq('^F', funcs.StringMsg(ctrl('f'))) + eq('^C', fn.String(ctrl('c'))) + eq('^A', fn.String(ctrl('a'))) + eq('^F', fn.String(ctrl('f'))) + eq('^C', fn.StringMsg(ctrl('c'))) + eq('^A', fn.StringMsg(ctrl('a'))) + eq('^F', fn.StringMsg(ctrl('f'))) end) it('prints CR, NL and tab as-is', function() - eq('\n', funcs.String('\n')) - eq('\r', funcs.String('\r')) - eq('\t', funcs.String('\t')) + eq('\n', fn.String('\n')) + eq('\r', fn.String('\r')) + eq('\t', fn.String('\t')) end) it('prints non-printable UTF-8 in <> notation', function() -- SINGLE SHIFT TWO, unicode control - eq('<8e>', funcs.String(funcs.nr2char(0x8E))) - eq('<8e>', funcs.StringMsg(funcs.nr2char(0x8E))) + eq('<8e>', fn.String(fn.nr2char(0x8E))) + eq('<8e>', fn.StringMsg(fn.nr2char(0x8E))) -- Surrogate pair: U+1F0A0 PLAYING CARD BACK is represented in UTF-16 as -- 0xD83C 0xDCA0. This is not valid in UTF-8. - eq('<d83c>', funcs.String(funcs.nr2char(0xD83C))) - eq('<dca0>', funcs.String(funcs.nr2char(0xDCA0))) - eq('<d83c><dca0>', funcs.String(funcs.nr2char(0xD83C) .. funcs.nr2char(0xDCA0))) - eq('<d83c>', funcs.StringMsg(funcs.nr2char(0xD83C))) - eq('<dca0>', funcs.StringMsg(funcs.nr2char(0xDCA0))) - eq('<d83c><dca0>', funcs.StringMsg(funcs.nr2char(0xD83C) .. funcs.nr2char(0xDCA0))) + eq('<d83c>', fn.String(fn.nr2char(0xD83C))) + eq('<dca0>', fn.String(fn.nr2char(0xDCA0))) + eq('<d83c><dca0>', fn.String(fn.nr2char(0xD83C) .. fn.nr2char(0xDCA0))) + eq('<d83c>', fn.StringMsg(fn.nr2char(0xD83C))) + eq('<dca0>', fn.StringMsg(fn.nr2char(0xDCA0))) + eq('<d83c><dca0>', fn.StringMsg(fn.nr2char(0xD83C) .. fn.nr2char(0xDCA0))) end) end) end) |