Mercurial > vim
annotate src/testdir/test_gf.vim @ 22081:2b9a2bc77b42 v8.2.1590
patch 8.2.1590: Vim9: bufnr() doesn't take "true" argument
Commit: https://github.com/vim/vim/commit/fe136c9a85412f4bdb5de70ef8416af5fa382b28
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 4 18:35:26 2020 +0200
patch 8.2.1590: Vim9: bufnr() doesn't take "true" argument
Problem: Vim9: bufnr() doesn't take "true" argument.
Solution: use tv_get_bool_chk(). (closes https://github.com/vim/vim/issues/6863)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 04 Sep 2020 18:45:04 +0200 |
parents | 6c634e63989c |
children | d37e4a856246 |
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>")) |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 if has("ebcdic") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 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
|
25 set isf=@,48-57,/,.,-,_,+,,,$,~,\ |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endif |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call search("^third") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call search("name") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 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
|
30 call search("^fourth") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call search("URL") |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 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
|
33 |
13103
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("^fifth") |
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 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
|
36 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
|
37 |
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
|
38 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
|
39 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
|
40 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
|
41 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
42 %d |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
43 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
|
44 wincmd f |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
45 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
|
46 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
|
47 close! |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
48 |
10145
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 set isf&vim |
eb9a7296ae9f
commit https://github.com/vim/vim/commit/53f1673cd909eb1c809c6a9086e3d104a0df9bed
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 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
|
51 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
|
52 |
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 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 new |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
59 set isfname-=: |
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 |
18939
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
69 enew! |
25ebc35e104f
patch 8.2.0030: "gF" does not work on output of "verbose command"
Bram Moolenaar <Bram@vim.org>
parents:
18552
diff
changeset
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
77 " 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
|
78 %bw! |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
79 edit Xfile1 |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
80 call setline(1, ['one', 'Xfile:4', 'three']) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
81 exe "normal 2G\<C-W>F" |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
82 call assert_equal('Xfile', bufname('%')) |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
83 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
|
84 |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
85 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
|
86 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
|
87 call delete('Xfile2') |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20978
diff
changeset
|
88 %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
|
89 endfunc |
16564
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
90 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
91 " 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
|
92 func Test_gf() |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
93 if has("ebcdic") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
94 set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
95 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
96 set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
97 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
98 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
99 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
|
100 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
101 call writefile([" ${CDIR}/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
102 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
103 call writefile([" $TDIR/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
104 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
105 new Xtestgf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
106 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
107 let $CDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
108 /CDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
109 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
110 if has("amiga") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
111 let $TDIR = "/testdir" |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
112 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
113 let $TDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
114 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
115 /TDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
116 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
117 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
118 normal gf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
119 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
|
120 close! |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
121 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
122 call delete('Xtest1') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
123 call delete('Xtestgf') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
124 endfunc |
18552
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_visual() |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
127 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
|
128 new |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
129 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
|
130 set hidden |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
131 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
132 " 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
|
133 norm! ttvtXgf |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
134 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
|
135 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
136 " 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
|
137 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
|
138 normal VGgf |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
139 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
|
140 |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
141 bwipe! |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
142 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
|
143 set hidden& |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
144 endfunc |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
145 |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
146 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
|
147 new |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
148 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
|
149 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
|
150 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
|
151 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
|
152 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
|
153 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
|
154 |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
155 " 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
|
156 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
|
157 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
|
158 try |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 au! InsertCharPre |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
165 |
18552
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
166 bwipe! |
17ec36265fcb
patch 8.1.2270: "gf" is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents:
16564
diff
changeset
|
167 endfunc |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
168 |
20978
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
169 " 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
|
170 " the file. |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
171 func Test_gf_includeexpr() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
172 new |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
173 let g:Inc_fname = '' |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
174 func IncFunc() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
175 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
|
176 return v:fname |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
177 endfunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
178 setlocal includeexpr=IncFunc() |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
179 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
|
180 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
|
181 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
|
182 close! |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
183 delfunc IncFunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
184 endfunc |
2c3e7a6bd6c6
patch 8.2.1040: not enough testing for movement commands
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
185 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
18939
diff
changeset
|
186 " vim: shiftwidth=2 sts=2 expandtab |