@@ -733,6 +733,9 @@ endfunc
733733
734734" Tests for guessing the tag location
735735func Test_tag_guess ()
736+ " in case a previous failure left a swap file behind
737+ call delete (' .Xfoo.swp' )
738+
736739 call writefile ([" !_TAG_FILE_ENCODING\t utf-8\t //" ,
737740 \ " func1\t Xfoo\t /^int func1(int x)/" ,
738741 \ " func2\t Xfoo\t /^int func2(int y)/" ,
@@ -769,6 +772,9 @@ endfunc
769772
770773" Test for an unsorted tags file
771774func Test_tag_sort ()
775+ " in case a previous failure left a swap file behind
776+ call delete (' .Xfoo.swp' )
777+
772778 let l = [
773779 \ " first\t Xfoo\t 1" ,
774780 \ " ten\t Xfoo\t 3" ,
@@ -796,6 +802,9 @@ endfunc
796802
797803" Test for an unsorted tags file
798804func Test_tag_fold ()
805+ " in case a previous failure left a swap file behind
806+ call delete (' .Xfoo.swp' )
807+
799808 call writefile ([
800809 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
801810 \ " !_TAG_FILE_SORTED\t 2\t /0=unsorted, 1=sorted, 2=foldcase/" ,
@@ -822,6 +831,9 @@ endfunc
822831
823832" Test for the :ltag command
824833func Test_ltag ()
834+ " in case a previous failure left a swap file behind
835+ call delete (' .Xfoo.swp' )
836+
825837 call writefile ([
826838 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
827839 \ " first\t Xfoo\t 1" ,
@@ -859,6 +871,9 @@ endfunc
859871" Test for setting the last search pattern to the tag search pattern
860872" when cpoptions has 't'
861873func Test_tag_last_search_pat ()
874+ " in case a previous failure left a swap file behind
875+ call delete (' .Xfoo.swp' )
876+
862877 call writefile ([
863878 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
864879 \ " first\t Xfoo\t /^int first() {}/" ,
@@ -887,6 +902,9 @@ endfunc
887902
888903" Tag stack tests
889904func Test_tag_stack ()
905+ " in case a previous failure left a swap file behind
906+ call delete (' .Xfoo.swp' )
907+
890908 let l = []
891909 for i in range (10 , 31 )
892910 let l += [" var" .. i .. " \t Xfoo\t /^int var" .. i .. " ;$/" ]
@@ -949,6 +967,9 @@ endfunc
949967
950968" Test for browsing multiple matching tags
951969func Test_tag_multimatch ()
970+ " in case a previous failure left a swap file behind
971+ call delete (' .Xfoo.swp' )
972+
952973 call writefile ([
953974 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
954975 \ " first\t Xfoo\t 1" ,
@@ -994,6 +1015,9 @@ endfunc
9941015
9951016" Test for previewing multiple matching tags
9961017func Test_preview_tag_multimatch ()
1018+ " in case a previous failure left a swap file behind
1019+ call delete (' .Xfoo.swp' )
1020+
9971021 call writefile ([
9981022 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
9991023 \ " first\t Xfoo\t 1" ,
@@ -1042,6 +1066,9 @@ endfunc
10421066
10431067" Test for jumping to multiple matching tags across multiple :tags commands
10441068func Test_tnext_multimatch ()
1069+ " in case a previous failure left a swap file behind
1070+ call delete (' .Xfoo.swp' )
1071+
10451072 call writefile ([
10461073 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
10471074 \ " first\t Xfoo1\t 1" ,
@@ -1069,6 +1096,9 @@ endfunc
10691096
10701097" Test for jumping to multiple matching tags in non-existing files
10711098func Test_multimatch_non_existing_files ()
1099+ " in case a previous failure left a swap file behind
1100+ call delete (' .Xfoo.swp' )
1101+
10721102 call writefile ([
10731103 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
10741104 \ " first\t Xfoo1\t 1" ,
@@ -1086,6 +1116,9 @@ func Test_multimatch_non_existing_files()
10861116endfunc
10871117
10881118func Test_tselect_listing ()
1119+ " in case a previous failure left a swap file behind
1120+ call delete (' .Xfoo.swp' )
1121+
10891122 call writefile ([
10901123 \ " !_TAG_FILE_ENCODING\t utf-8\t //" ,
10911124 \ " first\t Xfoo\t 1" .. ' ;"' .. " \t v\t typeref:typename:int\t file:" ,
@@ -1467,6 +1500,9 @@ endfunc
14671500
14681501" Test for 'tagbsearch' (binary search)
14691502func Test_tagbsearch ()
1503+ " in case a previous failure left a swap file behind
1504+ call delete (' .Xfoo.swp' )
1505+
14701506 " If a tags file header says the tags are sorted, but the tags are actually
14711507 " unsorted, then binary search should fail and linear search should work.
14721508 call writefile ([
0 commit comments