annotate src/testdir/test_gf.vim @ 31942:f5675b905d89 v9.0.1303

patch 9.0.1303: Motif: scrollbar width/height wrong when maximized Commit: https://github.com/vim/vim/commit/094b8473edcc7531c942ac726dd575d95f5b622c Author: qsmodo <75080827+qsmodo@users.noreply.github.com> Date: Sat Feb 11 19:12:57 2023 +0000 patch 9.0.1303: Motif: scrollbar width/height wrong when maximized Problem: Motif: scrollbar width/height wrong when maximized. Solution: Set the width/height when creating the scrollbar. (closes https://github.com/vim/vim/issues/11946)
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Feb 2023 20:15:03 +0100
parents 5614e76f3dee
children bfc23ba1bba5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20978
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
1 " Test for the gf and gF (goto file) commands
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " 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
4 " 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
5 func Test_gf_url()
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 enew!
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 call append(0, [
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 \ "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
9 \ "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
10 \ "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
11 \ "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
12 \ "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
13 \ "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
14 \ ])
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call cursor(1,1)
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call search("^first")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call search("tmp")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 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
19 call search("^second")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call search("URL")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>"))
27490
fb4c30606b4a patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
22 set isf=@,48-57,/,.,-,_,+,,,$,~,\
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call search("^third")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 call search("name")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 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
26 call search("^fourth")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 call search("URL")
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 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
29
13103
788d01164bb2 patch 8.0.1426: "gf" and <cfile> don't accept ? and & in URL
Christian Brabandt <cb@256bit.org>
parents: 11440
diff changeset
30 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
31 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
32 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
33
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
34 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
35 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
36 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
37
20978
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
38 %d
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
39 call setline(1, "demo://remote_file")
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
40 wincmd f
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
41 call assert_equal('demo://remote_file', @%)
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
42 call assert_equal(2, winnr('$'))
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
43 close!
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
44
10145
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 set isf&vim
eb9a7296ae9f commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 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
47 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
48
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 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
50 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
51 call setline(1, ['111', '222', '333', '444'])
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
52 w! Xgffile
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 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
54 new
11440
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
55 set isfname-=:
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
56 call setline(1, ['one', 'Xgffile: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
57 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
58 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
59 call assert_equal(2, getcurpos()[1])
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
60 w! Xgffile2
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
61 normal gF
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
62 call assert_equal('Xgffile', bufname('%'))
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
63 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
64
18939
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
65 enew!
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
66 call setline(1, ['one', 'the Xgffile line 2, and more', 'three'])
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
67 w! Xgffile2
18939
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
68 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
69 normal gF
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
70 call assert_equal('Xgffile', bufname('%'))
18939
25ebc35e104f patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents: 18552
diff changeset
71 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
72
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
73 " jumping to the file/line with CTRL-W_F
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
74 %bw!
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
75 edit Xfile1
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
76 call setline(1, ['one', 'Xgffile:4', 'three'])
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
77 exe "normal 2G\<C-W>F"
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
78 call assert_equal('Xgffile', bufname('%'))
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
79 call assert_equal(4, getcurpos()[1])
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
80
11440
f9f2e9aa884c patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11438
diff changeset
81 set isfname&
30051
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
82 call delete('Xgffile')
13b02c1ea0f7 patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents: 29570
diff changeset
83 call delete('Xgffile2')
21020
6c634e63989c patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents: 20978
diff changeset
84 %bw!
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
85 endfunc
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
86
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
87 " 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
88 func Test_gf()
27490
fb4c30606b4a patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
89 set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,}
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
90
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
91 call writefile(["Test for gf command"], "Xtest1", 'D')
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
92 if has("unix")
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
93 call writefile([" ${CDIR}/Xtest1"], "Xtestgf", 'D')
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
94 else
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
95 call writefile([" $TDIR/Xtest1"], "Xtestgf", 'D')
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
96 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
97 new Xtestgf
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
98 if has("unix")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
99 let $CDIR = "."
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
100 /CDIR
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
101 else
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
102 if has("amiga")
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
103 let $TDIR = "/testdir"
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
104 else
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
105 let $TDIR = "."
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
106 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
107 /TDIR
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
108 endif
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
109
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
110 normal gf
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
111 call assert_equal('Xtest1', fnamemodify(bufname(''), ":t"))
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
112
16564
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
113 close!
6d9461653dc5 patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents: 15993
diff changeset
114 endfunc
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
115
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
116 func Test_gf_visual()
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
117 call writefile(['one', 'two', 'three', 'four'], "Xtest_gf_visual", 'D')
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
118 new
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
119 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
120 set hidden
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
121
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
122 " 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
123 norm! ttvtXgf
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
124 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
125
20978
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
126 " if multiple lines are selected, then gf should fail
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
127 call setline(1, ["one", "two"])
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
128 normal VGgf
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
129 call assert_equal('Xtest_gf_visual', @%)
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
130
22270
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
131 " following line number is used for gF
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
132 bwipe!
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
133 new
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
134 call setline(1, 'XXXtest_gf_visual:3XXX')
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
135 norm! 0ttvt:gF
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
136 call assert_equal('Xtest_gf_visual', bufname('%'))
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
137 call assert_equal(3, getcurpos()[1])
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
138
29570
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
139 " do not include the NUL at the end
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
140 call writefile(['x'], 'Xvisual', 'D')
28867
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
141 let save_enc = &enc
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
142 for enc in ['latin1', 'utf-8']
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
143 exe "set enc=" .. enc
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
144 new
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
145 call setline(1, 'Xvisual')
28867
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
146 set nomodified
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
147 exe "normal \<C-V>$gf"
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
148 call assert_equal('Xvisual', bufname())
28867
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
149 bwipe!
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
150 endfor
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
151 let &enc = save_enc
987d29ca36a5 patch 8.2.4956: reading past end of line with "gf" in Visual block mode
Bram Moolenaar <Bram@vim.org>
parents: 27490
diff changeset
152
22270
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
153 " line number in visual area is used for file name
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
154 if has('unix')
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
155 bwipe!
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
156 call writefile([], "Xtest_gf_visual:3", 'D')
22270
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
157 new
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
158 call setline(1, 'XXXtest_gf_visual:3XXX')
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
159 norm! 0ttvtXgF
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
160 call assert_equal('Xtest_gf_visual:3', bufname('%'))
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
161 endif
d37e4a856246 patch 8.2.1684: "gF" does not use line number after file in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 21020
diff changeset
162
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
163 bwipe!
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
164 set hidden&
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
165 endfunc
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
166
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
167 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
168 new
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
169 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
170 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
171 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
172 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
173 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
174 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
175
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
176 " 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
177 au InsertCharPre <buffer> normal! gF<CR>
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
178 let caught_e565 = 0
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
179 try
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
180 call feedkeys("ix\<esc>", 'xt')
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
181 catch /^Vim\%((\a\+)\)\=:E565/ " catch E565
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
182 let caught_e565 = 1
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
183 endtry
20118
252d2bb90394 patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
184 call assert_equal(1, caught_e565)
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
185 au! InsertCharPre
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
186
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
187 bwipe!
22502
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
188
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
189 " gf is not allowed when buffer is locked
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
190 new
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
191 augroup Test_gf
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
192 au!
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
193 au OptionSet diff norm! gf
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
194 augroup END
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
195 call setline(1, ['Xfile1', 'line2', 'line3', 'line4'])
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
196 call test_override('starting', 1)
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
197 call assert_fails('diffthis', 'E788:')
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
198 call test_override('starting', 0)
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
199 augroup Test_gf
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
200 au!
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
201 augroup END
1503ecd54f8a patch 8.2.1799: some Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 22270
diff changeset
202 bw!
18552
17ec36265fcb patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16564
diff changeset
203 endfunc
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
204
20978
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
205 " If a file is not found by 'gf', then 'includeexpr' should be used to locate
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
206 " the file.
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
207 func Test_gf_includeexpr()
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
208 new
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
209 let g:Inc_fname = ''
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
210 func IncFunc()
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
211 let g:Inc_fname = v:fname
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
212 return v:fname
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
213 endfunc
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
214 setlocal includeexpr=IncFunc()
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
215 call setline(1, 'somefile.java')
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
216 call assert_fails('normal gf', 'E447:')
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
217 call assert_equal('somefile.java', g:Inc_fname)
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
218 close!
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
219 delfunc IncFunc
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
220 endfunc
2c3e7a6bd6c6 patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents: 20118
diff changeset
221
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
222 " Test for using a script-local function for 'includeexpr'
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
223 func Test_includeexpr_scriptlocal_func()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
224 func! s:IncludeFunc()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
225 let g:IncludeFname = v:fname
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
226 return ''
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
227 endfunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
228 set includeexpr=s:IncludeFunc()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
229 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr)
31821
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
230 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &g:includeexpr)
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
231 new | only
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
232 call setline(1, 'TestFile1')
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
233 let g:IncludeFname = ''
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
234 call assert_fails('normal! gf', 'E447:')
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
235 call assert_equal('TestFile1', g:IncludeFname)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
236 bw!
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
237 set includeexpr=<SID>IncludeFunc()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
238 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr)
31821
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
239 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &g:includeexpr)
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
240 new | only
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
241 call setline(1, 'TestFile2')
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
242 let g:IncludeFname = ''
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
243 call assert_fails('normal! gf', 'E447:')
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
244 call assert_equal('TestFile2', g:IncludeFname)
31821
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
245 bw!
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
246 setlocal includeexpr=
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
247 setglobal includeexpr=s:IncludeFunc()
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
248 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &g:includeexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
249 call assert_equal('', &includeexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
250 new
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
251 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
252 call setline(1, 'TestFile3')
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
253 let g:IncludeFname = ''
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
254 call assert_fails('normal! gf', 'E447:')
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
255 call assert_equal('TestFile3', g:IncludeFname)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
256 bw!
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
257 setlocal includeexpr=
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
258 setglobal includeexpr=<SID>IncludeFunc()
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
259 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &g:includeexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
260 call assert_equal('', &includeexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
261 new
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
262 call assert_equal(expand('<SID>') .. 'IncludeFunc()', &includeexpr)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
263 call setline(1, 'TestFile4')
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
264 let g:IncludeFname = ''
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
265 call assert_fails('normal! gf', 'E447:')
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
266 call assert_equal('TestFile4', g:IncludeFname)
5614e76f3dee patch 9.0.1243: :setglobal cannot use script-local function for "expr" option
Bram Moolenaar <Bram@vim.org>
parents: 30568
diff changeset
267 bw!
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
268 set includeexpr&
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
269 delfunc s:IncludeFunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
270 bw!
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
271 endfunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 22502
diff changeset
272
29570
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
273 " Check that expanding directories can handle more than 255 entries.
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
274 func Test_gf_subdirs_wildcard()
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
275 let cwd = getcwd()
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
276 let dir = 'Xtestgf_dir'
30568
bcd204e28fed patch 9.0.0619: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 30051
diff changeset
277 call mkdir(dir, 'R')
29570
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
278 call chdir(dir)
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
279 for i in range(300)
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
280 call mkdir(i)
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
281 call writefile([], i .. '/' .. i, 'S')
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
282 endfor
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
283 set path=./**
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
284
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
285 new | only
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
286 call setline(1, '99')
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
287 w! Xtest1
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
288 normal gf
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
289 call assert_equal('99', fnamemodify(bufname(''), ":t"))
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
290
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
291 call chdir(cwd)
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
292 set path&
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
293 endfunc
bc47aeacc8d8 patch 9.0.0126: expanding file names fails in dir with more than 255 entries
Bram Moolenaar <Bram@vim.org>
parents: 28867
diff changeset
294
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 18939
diff changeset
295 " vim: shiftwidth=2 sts=2 expandtab