From 7c3a87182d471649126c58d999d46abede6f60cd Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Jul 2022 09:10:25 +0800 Subject: vim-patch:8.2.1040: not enough testing for movement commands Problem: Not enough testing for movement commands. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#6313) https://github.com/vim/vim/commit/bdd2c290d3cda69e0046c42f0c651f60bc510a16 Cherry-pick test_functions.vim changes from patch 8.2.0183. Cherry-pick Test_normal18_z_fold() change from patch 8.2.0540. --- src/nvim/testdir/test_gf.vim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/nvim/testdir/test_gf.vim') diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim index 51e1a06390..1569177d66 100644 --- a/src/nvim/testdir/test_gf.vim +++ b/src/nvim/testdir/test_gf.vim @@ -35,6 +35,13 @@ func Test_gf_url() call search("URL") call assert_equal("URL://machine.name:1234?q=vim", expand("")) + %d + call setline(1, "demo://remote_file") + wincmd f + call assert_equal('demo://remote_file', @%) + call assert_equal(2, winnr('$')) + close! + set isf&vim enew! endfunc @@ -170,4 +177,21 @@ func Test_gf_error() bwipe! endfunc +" If a file is not found by 'gf', then 'includeexpr' should be used to locate +" the file. +func Test_gf_includeexpr() + new + let g:Inc_fname = '' + func IncFunc() + let g:Inc_fname = v:fname + return v:fname + endfunc + setlocal includeexpr=IncFunc() + call setline(1, 'somefile.java') + call assert_fails('normal gf', 'E447:') + call assert_equal('somefile.java', g:Inc_fname) + close! + delfunc IncFunc +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit