annotate src/testdir/test_gf.vim @ 19783:546bdeef35f1 v8.2.0448

patch 8.2.0448: various functions not properly tested Commit: https://github.com/vim/vim/commit/0e05de46226eb4e5ea580beefa71831f92d613d3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 25 22:23:46 2020 +0100 patch 8.2.0448: various functions not properly tested Problem: Various functions not properly tested. Solution: Add more tests, especially for failures. (Yegappan Lakshmanan, closes #5843)
author Bram Moolenaar <Bram@vim.org>
date Wed, 25 Mar 2020 22:30:04 +0100
parents f70a3c1000bb
children 252d2bb90394
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " This is a test if a URL is recognized by "gf", with the cursor before and
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " after the "://". Also test ":\\".
11436
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
4 func Test_gf_url()
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 enew!
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 call append(0, [
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 \ "first test for URL://machine.name/tmp/vimtest2a and other text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 \ "second test for URL://machine.name/tmp/vimtest2b. And other text",
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 \ "third test for URL:\\\\machine.name\\vimtest2c and other text",
13103
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
10 \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text",
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
11 \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text",
15993
58610c4d785c patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents: 13103
diff changeset
12 \ "sixth test for URL://machine.name:1234?q=vim and other text",
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 \ ])
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call search("^first")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call search("tmp")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>"))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call search("^second")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 call search("URL")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>"))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 if has("ebcdic")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 else
15993
58610c4d785c patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents: 13103
diff changeset
24 set isf=@,48-57,/,.,-,_,+,,,$,~,\
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 endif
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 call search("^third")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call search("name")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>"))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call search("^fourth")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 call search("URL")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>"))
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
13103
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
33 call search("^fifth")
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
34 call search("URL")
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
35 call assert_equal("URL://machine.name/tmp?q=vim&opt=yes", expand("<cfile>"))
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
36
15993
58610c4d785c patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents: 13103
diff changeset
37 call search("^sixth")
58610c4d785c patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents: 13103
diff changeset
38 call search("URL")
58610c4d785c patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents: 13103
diff changeset
39 call assert_equal("URL://machine.name:1234?q=vim", expand("<cfile>"))
58610c4d785c patch 8.1.1002: "gf" does not always work when URL has a port number
Bram Moolenaar <Bram@vim.org>
parents: 13103
diff changeset
40
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 set isf&vim
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 enew!
11436
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
43 endfunc
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
44
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
45 func Test_gF()
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
46 new
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
47 call setline(1, ['111', '222', '333', '444'])
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
48 w! Xfile
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
49 close
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
50 new
11440
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
51 set isfname-=:
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
52 call setline(1, ['one', 'Xfile:3', 'three'])
11436
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
53 2
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
54 call assert_fails('normal gF', 'E37:')
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
55 call assert_equal(2, getcurpos()[1])
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
56 w! Xfile2
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
57 normal gF
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
58 call assert_equal('Xfile', bufname('%'))
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
59 call assert_equal(3, getcurpos()[1])
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
60
18939
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
61 enew!
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
62 call setline(1, ['one', 'the Xfile line 2, and more', 'three'])
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
63 w! Xfile2
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
64 normal 2GfX
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
65 normal gF
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
66 call assert_equal('Xfile', bufname('%'))
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
67 call assert_equal(2, getcurpos()[1])
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
68
11440
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
69 set isfname&
11436
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
70 call delete('Xfile')
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
71 call delete('Xfile2')
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
72 bwipe Xfile
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
73 bwipe Xfile2
69b52a770b29 patch 8.0.0602: when gF fails to edit the file the cursor still moves
Christian Brabandt <cb@256bit.org>
parents: 10145
diff changeset
74 endfunc
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
75
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
76 " Test for invoking 'gf' on a ${VAR} variable
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
77 func Test_gf()
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
78 if has("ebcdic")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
79 set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,}
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
80 else
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
81 set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,}
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
82 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
83
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
84 call writefile(["Test for gf command"], "Xtest1")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
85 if has("unix")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
86 call writefile([" ${CDIR}/Xtest1"], "Xtestgf")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
87 else
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
88 call writefile([" $TDIR/Xtest1"], "Xtestgf")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
89 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
90 new Xtestgf
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
91 if has("unix")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
92 let $CDIR = "."
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
93 /CDIR
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
94 else
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
95 if has("amiga")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
96 let $TDIR = "/testdir"
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
97 else
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
98 let $TDIR = "."
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
99 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
100 /TDIR
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
101 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
102
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
103 normal gf
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
104 call assert_equal('Xtest1', fnamemodify(bufname(''), ":t"))
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
105 close!
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
106
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
107 call delete('Xtest1')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
108 call delete('Xtestgf')
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
109 endfunc
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
110
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
111 func Test_gf_visual()
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
112 call writefile([], "Xtest_gf_visual")
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
113 new
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
114 call setline(1, 'XXXtest_gf_visualXXX')
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
115 set hidden
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
116
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
117 " Visually select Xtest_gf_visual and use gf to go to that file
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
118 norm! ttvtXgf
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
119 call assert_equal('Xtest_gf_visual', bufname('%'))
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
120
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
121 bwipe!
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
122 call delete('Xtest_gf_visual')
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
123 set hidden&
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
124 endfunc
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
125
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
126 func Test_gf_error()
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
127 new
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
128 call assert_fails('normal gf', 'E446:')
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
129 call assert_fails('normal gF', 'E446:')
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
130 call setline(1, '/doesnotexist')
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
131 call assert_fails('normal gf', 'E447:')
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
132 call assert_fails('normal gF', 'E447:')
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
133 call assert_fails('normal [f', 'E447:')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
134
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
135 " gf is not allowed when text is locked
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
136 au InsertCharPre <buffer> normal! gF<CR>
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
137 let caught_e523 = 0
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
138 try
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
139 call feedkeys("ix\<esc>", 'xt')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
140 catch /^Vim\%((\a\+)\)\=:E523/ " catch E523
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
141 let caught_e523 = 1
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
142 endtry
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
143 call assert_equal(1, caught_e523)
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
144 au! InsertCharPre
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
145
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
146 bwipe!
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
147 endfunc
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
148
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
149 " vim: shiftwidth=2 sts=2 expandtab