aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-10-16 23:02:13 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-10-17 02:23:03 -0400
commita2e1bcd176bbacf4f63727429383436a160c4c58 (patch)
treef3ca7623088b20476c9d1cdd068a5fe68b6abaa2 /src/nvim/testdir
parent1d736a1ae2e5dfc0e47f221dd155058a5da92294 (diff)
downloadrneovim-a2e1bcd176bbacf4f63727429383436a160c4c58.tar.gz
rneovim-a2e1bcd176bbacf4f63727429383436a160c4c58.tar.bz2
rneovim-a2e1bcd176bbacf4f63727429383436a160c4c58.zip
vim-patch:8.2.1219: symlink not followed if dirname ends in //
Problem: Symlink not followed if dirname ends in //. Solution: Resolve symlink earlier. (Tomáš Janoušek, closes vim/vim#6454) https://github.com/vim/vim/commit/5966ea105ea86e52a734e04267956e11efffc92d
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_swap.vim30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_swap.vim b/src/nvim/testdir/test_swap.vim
index f440569d66..f27920d20f 100644
--- a/src/nvim/testdir/test_swap.vim
+++ b/src/nvim/testdir/test_swap.vim
@@ -334,4 +334,34 @@ func Test_swap_prompt_splitwin()
call delete('Xfile1')
endfunc
+func Test_swap_symlink()
+ if !has("unix")
+ return
+ endif
+
+ call writefile(['text'], 'Xtestfile')
+ silent !ln -s -f Xtestfile Xtestlink
+
+ set dir=.
+
+ " Test that swap file uses the name of the file when editing through a
+ " symbolic link (so that editing the file twice is detected)
+ edit Xtestlink
+ call assert_match('Xtestfile\.swp$', s:swapname())
+ bwipe!
+
+ call mkdir('Xswapdir')
+ exe 'set dir=' . getcwd() . '/Xswapdir//'
+
+ " Check that this also works when 'directory' ends with '//'
+ edit Xtestlink
+ call assert_match('Xtestfile\.swp$', s:swapname())
+ bwipe!
+
+ set dir&
+ call delete('Xtestfile')
+ call delete('Xtestlink')
+ call delete('Xswapdir', 'rf')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab