1 2" This is a test if a URL is recognized by "gf", with the cursor before and 3" after the "://". Also test ":\\". 4func 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 \ "fifth test for URL://machine.name/tmp?q=vim&opt=yes and other text", 12 \ ]) 13 call cursor(1,1) 14 call search("^first") 15 call search("tmp") 16 call assert_equal("URL://machine.name/tmp/vimtest2a", expand("<cfile>")) 17 call search("^second") 18 call search("URL") 19 call assert_equal("URL://machine.name/tmp/vimtest2b", expand("<cfile>")) 20 if has("ebcdic") 21 set isf=@,240-249,/,.,-,_,+,,,$,:,~,\ 22 else 23 set isf=@,48-57,/,.,-,_,+,,,$,:,~,\ 24 endif 25 call search("^third") 26 call search("name") 27 call assert_equal("URL:\\\\machine.name\\vimtest2c", expand("<cfile>")) 28 call search("^fourth") 29 call search("URL") 30 call assert_equal("URL:\\\\machine.name\\tmp\\vimtest2d", expand("<cfile>")) 31 32 call search("^fifth") 33 call search("URL") 34 call assert_equal("URL://machine.name/tmp?q=vim&opt=yes", expand("<cfile>")) 35 36 set isf&vim 37 enew! 38endfunc 39 40func Test_gF() 41 new 42 call setline(1, ['111', '222', '333', '444']) 43 w! Xfile 44 close 45 new 46 set isfname-=: 47 call setline(1, ['one', 'Xfile:3', 'three']) 48 2 49 call assert_fails('normal gF', 'E37:') 50 call assert_equal(2, getcurpos()[1]) 51 w! Xfile2 52 normal gF 53 call assert_equal('Xfile', bufname('%')) 54 call assert_equal(3, getcurpos()[1]) 55 56 set isfname& 57 call delete('Xfile') 58 call delete('Xfile2') 59 bwipe Xfile 60 bwipe Xfile2 61endfunc 62