blob: c4aa6f92185e133ab28fa7cdfbdc76f24c20cd68 [file] [log] [blame]
Bram Moolenaar53f16732016-09-07 20:46:39 +02001
2" This is a test if a URL is recognized by "gf", with the cursor before and
3" after the "://". Also test ":\\".
4function! Test_gf_url()
5 enew!
6 call append(0, [
7 \ "first test for URL://machine.name/tmp/vimtest2a and other text",
8 \ "second test for URL://machine.name/tmp/vimtest2b. And other text",
9 \ "third test for URL:\\\\machine.name\\vimtest2c and other text",
10 \ "fourth test for URL:\\\\machine.name\\tmp\\vimtest2d, and other text"
11 \ ])
12 call cursor(1,1)
13 call search("^first")
14 call search("tmp")
15 call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>"))
16 call search("^second")
17 call search("URL")
18 call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>"))
19 if has("ebcdic")
20 set isf=@,240-249,/,.,-,_,+,,,$,:,~,\
21 else
22 set isf=@,48-57,/,.,-,_,+,,,$,:,~,\
23 endif
24 call search("^third")
25 call search("name")
26 call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>"))
27 call search("^fourth")
28 call search("URL")
29 call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>"))
30
31 set isf&vim
32 enew!
33endfunction