mirror of
https://github.com/vim/vim.git
synced 2025-10-03 05:14:07 -04:00
patch 8.2.0078: expanding <sfile> works differently the second time
Problem: Expanding <sfile> works differently the second time. Solution: Keep the expanded name when redefining a function. (closes #5425)
This commit is contained in:
@@ -1642,6 +1642,23 @@ func Test_script_local_func()
|
||||
enew! | close
|
||||
endfunc
|
||||
|
||||
func Test_script_expand_sfile()
|
||||
let lines =<< trim END
|
||||
func s:snr()
|
||||
return expand('<sfile>')
|
||||
endfunc
|
||||
let g:result = s:snr()
|
||||
END
|
||||
call writefile(lines, 'Xexpand')
|
||||
source Xexpand
|
||||
call assert_match('<SNR>\d\+_snr', g:result)
|
||||
source Xexpand
|
||||
call assert_match('<SNR>\d\+_snr', g:result)
|
||||
|
||||
call delete('Xexpand')
|
||||
unlet g:result
|
||||
endfunc
|
||||
|
||||
func Test_compound_assignment_operators()
|
||||
" Test for number
|
||||
let x = 1
|
||||
|
Reference in New Issue
Block a user