diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-08-16 06:04:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 06:04:09 +0800 |
commit | 63e4436d8e9d25548cdc7c5b7e334ef164c150fc (patch) | |
tree | 63219cc75b3495147873595053a62b8ee4792052 /src/nvim/testdir | |
parent | e954d62527a6dc081d8942ccac740f17442446be (diff) | |
parent | d1464d16d6897144b29c22f8113aad9b7210e14c (diff) | |
download | rneovim-63e4436d8e9d25548cdc7c5b7e334ef164c150fc.tar.gz rneovim-63e4436d8e9d25548cdc7c5b7e334ef164c150fc.tar.bz2 rneovim-63e4436d8e9d25548cdc7c5b7e334ef164c150fc.zip |
Merge pull request #19781 from zeertzjq/source-lua-estack
fix(source): fix expand('<sfile>') no longer works for Lua
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_expand_func.vim | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_expand_func.vim b/src/nvim/testdir/test_expand_func.vim index fc0f7619c4..df01d84f19 100644 --- a/src/nvim/testdir/test_expand_func.vim +++ b/src/nvim/testdir/test_expand_func.vim @@ -41,7 +41,7 @@ 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 .. '\[4\]' , expand('<stack>')) + 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()) @@ -59,7 +59,32 @@ func Test_expand_sfile_and_stack() call writefile(lines, 'Xstack') source Xstack call assert_match('\<Xstack\[2\]$', g:stack_value) + unlet g:stack_value call delete('Xstack') + + if exists('+shellslash') + call mkdir('Xshellslash') + let lines =<< trim END + let g:stack1 = expand('<stack>') + set noshellslash + let g:stack2 = expand('<stack>') + set shellslash + let g:stack3 = expand('<stack>') + END + call writefile(lines, 'Xshellslash/Xstack') + " Test that changing 'shellslash' always affects the result of expand() + " when sourcing a script multiple times. + for i in range(2) + source Xshellslash/Xstack + call assert_match('\<Xshellslash/Xstack\[1\]$', g:stack1) + call assert_match('\<Xshellslash\\Xstack\[3\]$', g:stack2) + call assert_match('\<Xshellslash/Xstack\[5\]$', g:stack3) + unlet g:stack1 + unlet g:stack2 + unlet g:stack3 + endfor + call delete('Xshellslash', 'rf') + endif endfunc func Test_expand_slnum() |