aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-15 10:39:41 +0800
committerGitHub <noreply@github.com>2022-08-15 10:39:41 +0800
commita6f0e32d23930b5ab7d5c70d0c58e9964e3af408 (patch)
treed3b03ad0d09022a99f2adc006881a93ed0ebe670 /src/nvim/testdir
parent1c164689a4ef243be2a0e1b4332c9b6c56b5b031 (diff)
parent9ab9eb1220113d247dd1eb089cb6576a135b8699 (diff)
downloadrneovim-a6f0e32d23930b5ab7d5c70d0c58e9964e3af408.tar.gz
rneovim-a6f0e32d23930b5ab7d5c70d0c58e9964e3af408.tar.bz2
rneovim-a6f0e32d23930b5ab7d5c70d0c58e9964e3af408.zip
Merge pull request #19763 from zeertzjq/vim-8.2.1297
vim-patch:8.2.{1297,1653,1658}: expand('<stack>')
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_expand_func.vim20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/nvim/testdir/test_expand_func.vim b/src/nvim/testdir/test_expand_func.vim
index b48c2e8a19..fc0f7619c4 100644
--- a/src/nvim/testdir/test_expand_func.vim
+++ b/src/nvim/testdir/test_expand_func.vim
@@ -37,17 +37,29 @@ func Test_expand_sflnum()
delcommand Flnum
endfunc
-func Test_expand_sfile()
+func Test_expand_sfile_and_stack()
call assert_match('test_expand_func\.vim$', s:sfile)
- call assert_match('^function .*\.\.Test_expand_sfile$', expand('<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 .. '\[4\]' , expand('<stack>'))
" Call in script-local function
- call assert_match('^function .*\.\.Test_expand_sfile\[5\]\.\.<SNR>\d\+_expand_sfile$', s:expand_sfile())
+ call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack\[7\]\.\.<SNR>\d\+_expand_sfile$', s:expand_sfile())
" Call in command
command Sfile echo expand('<sfile>')
- call assert_match('^function .*\.\.Test_expand_sfile$', trim(execute('Sfile')))
+ call assert_match('script .*testdir/runtest.vim\[\d\+\]\.\.function RunTheTest\[\d\+\]\.\.Test_expand_sfile_and_stack$', trim(execute('Sfile')))
delcommand Sfile
+
+ " 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\[2\]$', g:stack_value)
+ call delete('Xstack')
endfunc
func Test_expand_slnum()