diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-24 16:20:19 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2025-02-28 18:21:08 +0800 |
commit | 6750d00fe96a04ab19cfc55fb406f6b40dbf970f (patch) | |
tree | 1cce38d22bbaccd9d250db074d7c3ba236526ce2 /test/functional/ex_cmds/source_spec.lua | |
parent | a3a9f86d4a11029542a94b00044b5a181a68c9cd (diff) | |
download | rneovim-6750d00fe96a04ab19cfc55fb406f6b40dbf970f.tar.gz rneovim-6750d00fe96a04ab19cfc55fb406f6b40dbf970f.tar.bz2 rneovim-6750d00fe96a04ab19cfc55fb406f6b40dbf970f.zip |
vim-patch:8.2.4603: sourcing buffer lines is too complicated
Problem: Sourcing buffer lines is too complicated.
Solution: Simplify the code. Make it possible to source Vim9 script lines.
(Yegappan Lakshmanan, closes vim/vim#9974)
https://github.com/vim/vim/commit/85b43c6cb7d56919e245622f4e42db6d8bee4194
This commit changes the behavior of sourcing buffer lines to always have
a script ID, although sourcing the same buffer always produces the same
script ID.
vim-patch:9.1.0372: Calling CLEAR_FIELD() on the same struct twice
Problem: Calling CLEAR_FIELD() on the same struct twice.
Solution: Remove the second CLEAR_FIELD(). Move the assignment of
cookie.sourceing_lnum (zeertzjq).
closes: vim/vim#14627
https://github.com/vim/vim/commit/f68517c1671dfedcc1555da50bc0b3de6d2842f6
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test/functional/ex_cmds/source_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/source_spec.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/test/functional/ex_cmds/source_spec.lua b/test/functional/ex_cmds/source_spec.lua index 8a15aa04d1..4548e51624 100644 --- a/test/functional/ex_cmds/source_spec.lua +++ b/test/functional/ex_cmds/source_spec.lua @@ -101,16 +101,14 @@ describe(':source', function() \ k: "v" "\ (o_o) \ } - let c = expand("<SID>")->empty() + let c = expand("<SID>") let s:s = 0zbeef.cafe let d = s:s]]) command('source') eq('2', exec_capture('echo a')) eq("{'k': 'v'}", exec_capture('echo b')) - - -- Script items are created only on script var access - eq('1', exec_capture('echo c')) + eq('<SNR>1_', exec_capture('echo c')) eq('0zBEEFCAFE', exec_capture('echo d')) exec('set cpoptions+=C') @@ -136,6 +134,10 @@ describe(':source', function() feed_command(':source') eq('3', exec_capture('echo a')) + -- Source last line only + feed_command(':$source') + eq('Vim(echo):E117: Unknown function: s:C', exc_exec('echo D()')) + -- Source from 2nd line to end of file feed('ggjVG') feed_command(':source') @@ -143,9 +145,9 @@ describe(':source', function() eq("{'K': 'V'}", exec_capture('echo b')) eq('<SNR>1_C()', exec_capture('echo D()')) - -- Source last line only + -- Source last line after the lines that define s:C() have been sourced feed_command(':$source') - eq('Vim(echo):E117: Unknown function: s:C', exc_exec('echo D()')) + eq('<SNR>1_C()', exec_capture('echo D()')) exec('set cpoptions+=C') eq("Vim(let):E723: Missing end of Dictionary '}': ", exc_exec("'<,'>source")) @@ -248,9 +250,9 @@ describe(':source', function() eq(12, eval('g:c')) eq(' \\ 1\n "\\ 2', exec_lua('return _G.a')) - eq(':source (no file)', api.nvim_get_var('sfile_value')) - eq(':source (no file)', api.nvim_get_var('stack_value')) - eq(':source (no file)', api.nvim_get_var('script_value')) + eq(':source buffer=1', api.nvim_get_var('sfile_value')) + eq(':source buffer=1', api.nvim_get_var('stack_value')) + eq(':source buffer=1', api.nvim_get_var('script_value')) end) end |