summaryrefslogtreecommitdiff
path: root/src/testdir/test_tagjump.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-04 23:00:41 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-04 23:00:41 +0000
commitd0f8d39d20f8d42f7451f781f7be0bcd20e06741 (patch)
tree12356592535e2b49d036caaa37f643eaf8c21fa5 /src/testdir/test_tagjump.vim
parenta0a6f3a22a934fa68b71d82c23e2f6bf6e5b18d0 (diff)
downloadvim-git-d0f8d39d20f8d42f7451f781f7be0bcd20e06741.tar.gz
patch 9.0.1005: a failed test may leave a swap file behindv9.0.1005
Problem: A failed test may leave a swap file behind. Solution: Delete the swap file to avoid another test to fail. Use another file name.
Diffstat (limited to 'src/testdir/test_tagjump.vim')
-rw-r--r--src/testdir/test_tagjump.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 5185b20b7..2c720a5b4 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -733,6 +733,9 @@ endfunc
" Tests for guessing the tag location
func Test_tag_guess()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
\ "func1\tXfoo\t/^int func1(int x)/",
\ "func2\tXfoo\t/^int func2(int y)/",
@@ -769,6 +772,9 @@ endfunc
" Test for an unsorted tags file
func Test_tag_sort()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
let l = [
\ "first\tXfoo\t1",
\ "ten\tXfoo\t3",
@@ -796,6 +802,9 @@ endfunc
" Test for an unsorted tags file
func Test_tag_fold()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "!_TAG_FILE_SORTED\t2\t/0=unsorted, 1=sorted, 2=foldcase/",
@@ -822,6 +831,9 @@ endfunc
" Test for the :ltag command
func Test_ltag()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1",
@@ -859,6 +871,9 @@ endfunc
" Test for setting the last search pattern to the tag search pattern
" when cpoptions has 't'
func Test_tag_last_search_pat()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t/^int first() {}/",
@@ -887,6 +902,9 @@ endfunc
" Tag stack tests
func Test_tag_stack()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
let l = []
for i in range(10, 31)
let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
@@ -949,6 +967,9 @@ endfunc
" Test for browsing multiple matching tags
func Test_tag_multimatch()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1",
@@ -994,6 +1015,9 @@ endfunc
" Test for previewing multiple matching tags
func Test_preview_tag_multimatch()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1",
@@ -1042,6 +1066,9 @@ endfunc
" Test for jumping to multiple matching tags across multiple :tags commands
func Test_tnext_multimatch()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo1\t1",
@@ -1069,6 +1096,9 @@ endfunc
" Test for jumping to multiple matching tags in non-existing files
func Test_multimatch_non_existing_files()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo1\t1",
@@ -1086,6 +1116,9 @@ func Test_multimatch_non_existing_files()
endfunc
func Test_tselect_listing()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
@@ -1467,6 +1500,9 @@ endfunc
" Test for 'tagbsearch' (binary search)
func Test_tagbsearch()
+ " in case a previous failure left a swap file behind
+ call delete('.Xfoo.swp')
+
" If a tags file header says the tags are sorted, but the tags are actually
" unsorted, then binary search should fail and linear search should work.
call writefile([