diff options
author | zeertzjq <zeertzjq@outlook.com> | 2025-02-22 16:38:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-22 08:38:12 +0000 |
commit | 5cead869fb6ddc57594c0dc7e6e575f9427630c8 (patch) | |
tree | 20082ed888b758167edd10006c62f39b8a8b2b9a /test | |
parent | 8d7eb03040c26e8e3bdbf51b25fe03a735b85b5b (diff) | |
download | rneovim-5cead869fb6ddc57594c0dc7e6e575f9427630c8.tar.gz rneovim-5cead869fb6ddc57594c0dc7e6e575f9427630c8.tar.bz2 rneovim-5cead869fb6ddc57594c0dc7e6e575f9427630c8.zip |
vim-patch:9.1.1135: 'suffixesadd' doesn't work with multiple items (#32573)
Problem: 'suffixesadd' doesn't work with multiple items
(after 9.1.1122).
Solution: Don't concat multiple suffixes together.
(zeertzjq)
fixes: vim/vim#16694
closes: vim/vim#16699
https://github.com/vim/vim/commit/bf595ae4ac9ecc1e0620664177072926ed3679ff
Diffstat (limited to 'test')
-rw-r--r-- | test/old/testdir/test_findfile.vim | 30 | ||||
-rw-r--r-- | test/old/testdir/test_gf.vim | 32 |
2 files changed, 62 insertions, 0 deletions
diff --git a/test/old/testdir/test_findfile.vim b/test/old/testdir/test_findfile.vim index 539c7a661a..62cdd767be 100644 --- a/test/old/testdir/test_findfile.vim +++ b/test/old/testdir/test_findfile.vim @@ -222,6 +222,36 @@ func Test_finddir_error() call assert_fails('call finddir("x", repeat("x", 5000))', 'E854:') endfunc +func Test_findfile_with_suffixesadd() + let save_path = &path + let save_dir = getcwd() + set path=,, + call mkdir('Xfinddir1', 'pR') + cd Xfinddir1 + + call writefile([], 'foo.c', 'D') + call writefile([], 'bar.cpp', 'D') + call writefile([], 'baz.cc', 'D') + call writefile([], 'foo.o', 'D') + call writefile([], 'bar.o', 'D') + call writefile([], 'baz.o', 'D') + + set suffixesadd=.c,.cpp + call assert_equal('foo.c', findfile('foo')) + call assert_equal('./foo.c', findfile('./foo')) + call assert_equal('bar.cpp', findfile('bar')) + call assert_equal('./bar.cpp', findfile('./bar')) + call assert_equal('', findfile('baz')) + call assert_equal('', findfile('./baz')) + set suffixesadd+=.cc + call assert_equal('baz.cc', findfile('baz')) + call assert_equal('./baz.cc', findfile('./baz')) + + set suffixesadd& + call chdir(save_dir) + let &path = save_path +endfunc + " Test for the :find, :sfind and :tabfind commands func Test_find_cmd() new diff --git a/test/old/testdir/test_gf.vim b/test/old/testdir/test_gf.vim index 9824c8276e..0e5d8407bc 100644 --- a/test/old/testdir/test_gf.vim +++ b/test/old/testdir/test_gf.vim @@ -361,4 +361,36 @@ func Test_gf_switchbuf() %bw! endfunc +func Test_gf_with_suffixesadd() + let cwd = getcwd() + let dir = 'Xtestgf_sua_dir' + call mkdir(dir, 'R') + call chdir(dir) + + call writefile([], 'foo.c', 'D') + call writefile([], 'bar.cpp', 'D') + call writefile([], 'baz.cc', 'D') + call writefile([], 'foo.o', 'D') + call writefile([], 'bar.o', 'D') + call writefile([], 'baz.o', 'D') + + new + setlocal path=,, suffixesadd=.c,.cpp + call setline(1, ['./foo', './bar', './baz']) + exe "normal! gg\<C-W>f" + call assert_equal('foo.c', expand('%:t')) + close + exe "normal! 2gg\<C-W>f" + call assert_equal('bar.cpp', expand('%:t')) + close + call assert_fails('exe "normal! 3gg\<C-W>f"', 'E447:') + setlocal suffixesadd+=.cc + exe "normal! 3gg\<C-W>f" + call assert_equal('baz.cc', expand('%:t')) + close + + %bwipe! + call chdir(cwd) +endfunc + " vim: shiftwidth=2 sts=2 expandtab |