aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_gf.vim
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-09-16 08:51:28 -0400
committerGitHub <noreply@github.com>2020-09-16 08:51:28 -0400
commitcf522488cca72b0dd6f19f0c0c3c007b8d118c3f (patch)
tree1d340fa93157488daad04192c33d5a43c0c3b217 /src/nvim/testdir/test_gf.vim
parentc3f4610922b3f26c952281481f65d255ad352ac5 (diff)
parent2ed48e71d3a55ee95579df80e46f3fa40639d84a (diff)
downloadrneovim-cf522488cca72b0dd6f19f0c0c3c007b8d118c3f.tar.gz
rneovim-cf522488cca72b0dd6f19f0c0c3c007b8d118c3f.tar.bz2
rneovim-cf522488cca72b0dd6f19f0c0c3c007b8d118c3f.zip
Merge pull request #12914 from janlazo/vim-8.2.1675
vim-patch:8.1.{2108,2222,2338},8.2.{637,1526,1675,1684}
Diffstat (limited to 'src/nvim/testdir/test_gf.vim')
-rw-r--r--src/nvim/testdir/test_gf.vim27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_gf.vim b/src/nvim/testdir/test_gf.vim
index 4a4ffcefa1..ee548037ba 100644
--- a/src/nvim/testdir/test_gf.vim
+++ b/src/nvim/testdir/test_gf.vim
@@ -1,3 +1,4 @@
+" Test for the gf and gF (goto file) commands
" This is a test if a URL is recognized by "gf", with the cursor before and
" after the "://". Also test ":\\".
@@ -109,7 +110,7 @@ func Test_gf()
endfunc
func Test_gf_visual()
- call writefile([], "Xtest_gf_visual")
+ call writefile(['one', 'two', 'three', 'four'], "Xtest_gf_visual")
new
call setline(1, 'XXXtest_gf_visualXXX')
set hidden
@@ -118,6 +119,30 @@ func Test_gf_visual()
norm! ttvtXgf
call assert_equal('Xtest_gf_visual', bufname('%'))
+ " if multiple lines are selected, then gf should fail
+ call setline(1, ["one", "two"])
+ normal VGgf
+ call assert_equal('Xtest_gf_visual', @%)
+
+ " following line number is used for gF
+ bwipe!
+ new
+ call setline(1, 'XXXtest_gf_visual:3XXX')
+ norm! 0ttvt:gF
+ call assert_equal('Xtest_gf_visual', bufname('%'))
+ call assert_equal(3, getcurpos()[1])
+
+ " line number in visual area is used for file name
+ if has('unix')
+ bwipe!
+ call writefile([], "Xtest_gf_visual:3")
+ new
+ call setline(1, 'XXXtest_gf_visual:3XXX')
+ norm! 0ttvtXgF
+ call assert_equal('Xtest_gf_visual:3', bufname('%'))
+ call delete('Xtest_gf_visual:3')
+ endif
+
bwipe!
call delete('Xtest_gf_visual')
set hidden&