diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2021-10-17 06:20:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-17 06:20:35 -0700 |
commit | 30af69509dc91552dc41451857b18907f018c1bd (patch) | |
tree | 7700d6d0b75e59ba40c351c328c3cf151b81e88c /test/functional/ex_cmds | |
parent | f19dc0608161622f7786eb3cddee27d086cc3ea3 (diff) | |
parent | da9b0abc67a936021a4ecf7634395db860edcab1 (diff) | |
download | rneovim-30af69509dc91552dc41451857b18907f018c1bd.tar.gz rneovim-30af69509dc91552dc41451857b18907f018c1bd.tar.bz2 rneovim-30af69509dc91552dc41451857b18907f018c1bd.zip |
Merge #15994 feat(:source, nvim_exec): script-local scope
Diffstat (limited to 'test/functional/ex_cmds')
-rw-r--r-- | test/functional/ex_cmds/source_spec.lua | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua index bdf6ae76d1..fa650d611b 100644 --- a/test/functional/ex_cmds/source_spec.lua +++ b/test/functional/ex_cmds/source_spec.lua @@ -25,12 +25,19 @@ describe(':source', function() let b = #{ \ k: "v" "\ (o_o) - \ }]]) + \ } + let c = expand("<SID>")->empty() + let s:s = 0zbeef.cafe + let d = s:s]]) command('source') eq('2', meths.exec('echo a', true)) eq("{'k': 'v'}", meths.exec('echo b', true)) + -- Script items are created only on script var access + eq("1", meths.exec('echo c', true)) + eq("0zBEEFCAFE", meths.exec('echo d', true)) + exec('set cpoptions+=C') eq('Vim(let):E15: Invalid expression: #{', exc_exec('source')) end) @@ -43,7 +50,11 @@ describe(':source', function() let b = #{ "\ (>_<) \ K: "V" - \ }]]) + \ } + function! s:C() abort + return expand("<SID>") .. "C()" + endfunction + let D = {-> s:C()}]]) -- Source the 2nd line only feed('ggjV') @@ -55,6 +66,11 @@ describe(':source', function() feed_command(':source') eq('4', meths.exec('echo a', true)) eq("{'K': 'V'}", meths.exec('echo b', true)) + eq("<SNR>1_C()", meths.exec('echo D()', true)) + + -- Source last line only + feed_command(':$source') + eq('Vim(echo):E117: Unknown function: s:C', exc_exec('echo D()')) exec('set cpoptions+=C') eq('Vim(let):E15: Invalid expression: #{', exc_exec("'<,'>source")) |