Mercurial > vim
annotate src/testdir/test_gf.vim @ 17178:40c4cb095d53 v8.1.1588
patch 8.1.1588: in :let-heredoc line continuation is recognized
commit https://github.com/vim/vim/commit/e96a2498f9a2d3e93ac07431f6d4afd77f30afdf
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 25 04:12:16 2019 +0200
patch 8.1.1588: in :let-heredoc line continuation is recognized
Problem: In :let-heredoc line continuation is recognized.
Solution: Do not consume line continuation. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4580)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 25 Jun 2019 04:15:08 +0200 |
parents | 6d9461653dc5 |
children | 17ec36265fcb |
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 |
11440
f9f2e9aa884c
patch 8.0.0604: gF test fails still on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11438
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 endfunc |
16564
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
67 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
68 " 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
|
69 func Test_gf() |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
70 if has("ebcdic") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
71 set isfname=@,240-249,/,.,-,_,+,,,$,:,~,{,} |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
72 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
73 set isfname=@,48-57,/,.,-,_,+,,,$,:,~,{,} |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
74 endif |
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 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
|
77 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
78 call writefile([" ${CDIR}/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
79 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
80 call writefile([" $TDIR/Xtest1"], "Xtestgf") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
81 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
82 new Xtestgf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
83 if has("unix") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
84 let $CDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
85 /CDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
86 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
87 if has("amiga") |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
88 let $TDIR = "/testdir" |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
89 else |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
90 let $TDIR = "." |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
91 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
92 /TDIR |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
93 endif |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
94 |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
95 normal gf |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
96 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
|
97 close! |
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 delete('Xtest1') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
100 call delete('Xtestgf') |
6d9461653dc5
patch 8.1.1285: test17 is old style
Bram Moolenaar <Bram@vim.org>
parents:
15993
diff
changeset
|
101 endfunc |