From 72652cbc46f568128bfc296ba63fb2d26941da8e Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 27 Mar 2022 10:25:55 -0700 Subject: feat(test): use nvim_exec in helpers.source() #16064 helpers.source() was a hack to work around the lack of anonymous :source. Its "create tempfile" behavior is not a required part of most tests that use it. Some tests still need the old "create tempfile" behavior either because they test SID behavior, or because of missing nvim_exec features: #16071 --- test/functional/api/command_spec.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/functional/api') diff --git a/test/functional/api/command_spec.lua b/test/functional/api/command_spec.lua index b80004f67c..94176fc2ce 100644 --- a/test/functional/api/command_spec.lua +++ b/test/functional/api/command_spec.lua @@ -65,6 +65,7 @@ describe('nvim_get_commands', function() local cmd3 = { addr=NIL, bang=false, bar=true, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R3_ohyeah()', name='Cmd3', nargs='0', range=NIL, register=false, keepscript=false, script_id=3, } local cmd4 = { addr=NIL, bang=false, bar=false, complete=NIL, complete_arg=NIL, count=NIL, definition='call \128\253R4_just_great()', name='Cmd4', nargs='0', range=NIL, register=true, keepscript=false, script_id=4, } source([[ + let s:foo = 1 command -complete=custom,ListUsers -nargs=+ Finger !finger ]]) eq({Finger=cmd1}, meths.get_commands({builtin=false})) @@ -72,12 +73,18 @@ describe('nvim_get_commands', function() eq({Finger=cmd1, TestCmd=cmd0}, meths.get_commands({builtin=false})) source([[ + function! s:foo() abort + endfunction command -bang -nargs=* Cmd2 call foo() ]]) source([[ + function! s:ohyeah() abort + endfunction command -bar -nargs=0 Cmd3 call ohyeah() ]]) source([[ + function! s:just_great() abort + endfunction command -register Cmd4 call just_great() ]]) -- TODO(justinmk): Order is stable but undefined. Sort before return? -- cgit