mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 18:36:30 +00:00
vim-patch:8.2.4726: cannot use expand() to get the script name
Problem: Cannot use expand() to get the script name.
Solution: Support expand('<script>'). (closes vim/vim#10121)
6013d0045d
Use `.sn_name` instead of `->sn_name` as v8.2.0154 hasn't been ported.
Cherry-pick builtin.txt expand() doc from latest Vim.
This commit is contained in:
@@ -166,6 +166,7 @@ describe(':source', function()
|
||||
vim.g.sourced_lua = 1
|
||||
vim.g.sfile_value = vim.fn.expand('<sfile>')
|
||||
vim.g.stack_value = vim.fn.expand('<stack>')
|
||||
vim.g.script_value = vim.fn.expand('<script>')
|
||||
]])
|
||||
|
||||
command('set shellslash')
|
||||
@@ -173,6 +174,7 @@ describe(':source', function()
|
||||
eq(1, eval('g:sourced_lua'))
|
||||
matches([[/test%.lua$]], meths.get_var('sfile_value'))
|
||||
matches([[/test%.lua$]], meths.get_var('stack_value'))
|
||||
matches([[/test%.lua$]], meths.get_var('script_value'))
|
||||
|
||||
os.remove(test_file)
|
||||
end)
|
||||
@@ -214,6 +216,7 @@ describe(':source', function()
|
||||
"\ 2]=]
|
||||
vim.g.sfile_value = vim.fn.expand('<sfile>')
|
||||
vim.g.stack_value = vim.fn.expand('<stack>')
|
||||
vim.g.script_value = vim.fn.expand('<script>')
|
||||
]])
|
||||
|
||||
command('edit '..test_file)
|
||||
@@ -223,6 +226,7 @@ describe(':source', function()
|
||||
eq(' \\ 1\n "\\ 2', exec_lua('return _G.a'))
|
||||
eq(':source (no file)', meths.get_var('sfile_value'))
|
||||
eq(':source (no file)', meths.get_var('stack_value'))
|
||||
eq(':source (no file)', meths.get_var('script_value'))
|
||||
|
||||
os.remove(test_file)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user