patch 8.2.1653: expand('<stack>') does not include the final line number
Problem: Expand('<stack>') does not include the final line number.
Solution: Add the line nuber. (closes #6927)
diff --git a/src/testdir/test_expand_func.vim b/src/testdir/test_expand_func.vim
index 42aa8e0..a63cc04 100644
--- a/src/testdir/test_expand_func.vim
+++ b/src/testdir/test_expand_func.vim
@@ -39,9 +39,9 @@
func Test_expand_sfile_and_stack()
call assert_match('test_expand_func\.vim$', s:sfile)
- let expected = 'script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack$'
- call assert_match(expected , expand('<sfile>'))
- call assert_match(expected , expand('<stack>'))
+ let expected = 'script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack'
+ call assert_match(expected .. '$', expand('<sfile>'))
+ call assert_match(expected .. '\[4\]' , expand('<stack>'))
" Call in script-local function
call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack\[7\]\.\.<SNR>\d\+_expand_sfile$', s:expand_sfile())
@@ -53,11 +53,12 @@
" Use <stack> from sourced script.
let lines =<< trim END
+ " comment here
let g:stack_value = expand('<stack>')
END
call writefile(lines, 'Xstack')
source Xstack
- call assert_match('\<Xstack$', g:stack_value)
+ call assert_match('\<Xstack\[2\]', g:stack_value)
call delete('Xstack')
endfunc