mirror of
https://github.com/vim/vim.git
synced 2025-09-30 04:44:14 -04:00
patch 9.0.1005: a failed test may leave a swap file behind
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.
This commit is contained in:
@@ -24,6 +24,9 @@ func Test_suspend()
|
|||||||
|
|
||||||
call WaitForResponses()
|
call WaitForResponses()
|
||||||
|
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
let buf = term_start('/bin/sh')
|
let buf = term_start('/bin/sh')
|
||||||
" Wait for shell prompt.
|
" Wait for shell prompt.
|
||||||
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
||||||
@@ -62,6 +65,7 @@ func Test_suspend()
|
|||||||
|
|
||||||
exe buf . 'bwipe!'
|
exe buf . 'bwipe!'
|
||||||
call delete('Xfoo')
|
call delete('Xfoo')
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_suspend_autocmd()
|
func Test_suspend_autocmd()
|
||||||
@@ -70,6 +74,9 @@ func Test_suspend_autocmd()
|
|||||||
|
|
||||||
call WaitForResponses()
|
call WaitForResponses()
|
||||||
|
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
let buf = term_start('/bin/sh', #{term_rows: 6})
|
let buf = term_start('/bin/sh', #{term_rows: 6})
|
||||||
" Wait for shell prompt.
|
" Wait for shell prompt.
|
||||||
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
|
||||||
@@ -108,6 +115,7 @@ func Test_suspend_autocmd()
|
|||||||
|
|
||||||
exe buf . 'bwipe!'
|
exe buf . 'bwipe!'
|
||||||
call delete('Xfoo')
|
call delete('Xfoo')
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -455,7 +455,7 @@ func Test_invalid_name()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_ownsyntax()
|
func Test_ownsyntax()
|
||||||
new Xfoo
|
new XfooOwnSyntax
|
||||||
call setline(1, '#define FOO')
|
call setline(1, '#define FOO')
|
||||||
syntax on
|
syntax on
|
||||||
set filetype=c
|
set filetype=c
|
||||||
|
@@ -733,6 +733,9 @@ endfunc
|
|||||||
|
|
||||||
" Tests for guessing the tag location
|
" Tests for guessing the tag location
|
||||||
func Test_tag_guess()
|
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//",
|
call writefile(["!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "func1\tXfoo\t/^int func1(int x)/",
|
\ "func1\tXfoo\t/^int func1(int x)/",
|
||||||
\ "func2\tXfoo\t/^int func2(int y)/",
|
\ "func2\tXfoo\t/^int func2(int y)/",
|
||||||
@@ -769,6 +772,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for an unsorted tags file
|
" Test for an unsorted tags file
|
||||||
func Test_tag_sort()
|
func Test_tag_sort()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
let l = [
|
let l = [
|
||||||
\ "first\tXfoo\t1",
|
\ "first\tXfoo\t1",
|
||||||
\ "ten\tXfoo\t3",
|
\ "ten\tXfoo\t3",
|
||||||
@@ -796,6 +802,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for an unsorted tags file
|
" Test for an unsorted tags file
|
||||||
func Test_tag_fold()
|
func Test_tag_fold()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "!_TAG_FILE_SORTED\t2\t/0=unsorted, 1=sorted, 2=foldcase/",
|
\ "!_TAG_FILE_SORTED\t2\t/0=unsorted, 1=sorted, 2=foldcase/",
|
||||||
@@ -822,6 +831,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for the :ltag command
|
" Test for the :ltag command
|
||||||
func Test_ltag()
|
func Test_ltag()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo\t1",
|
\ "first\tXfoo\t1",
|
||||||
@@ -859,6 +871,9 @@ endfunc
|
|||||||
" Test for setting the last search pattern to the tag search pattern
|
" Test for setting the last search pattern to the tag search pattern
|
||||||
" when cpoptions has 't'
|
" when cpoptions has 't'
|
||||||
func Test_tag_last_search_pat()
|
func Test_tag_last_search_pat()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo\t/^int first() {}/",
|
\ "first\tXfoo\t/^int first() {}/",
|
||||||
@@ -887,6 +902,9 @@ endfunc
|
|||||||
|
|
||||||
" Tag stack tests
|
" Tag stack tests
|
||||||
func Test_tag_stack()
|
func Test_tag_stack()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
let l = []
|
let l = []
|
||||||
for i in range(10, 31)
|
for i in range(10, 31)
|
||||||
let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
|
let l += ["var" .. i .. "\tXfoo\t/^int var" .. i .. ";$/"]
|
||||||
@@ -949,6 +967,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for browsing multiple matching tags
|
" Test for browsing multiple matching tags
|
||||||
func Test_tag_multimatch()
|
func Test_tag_multimatch()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo\t1",
|
\ "first\tXfoo\t1",
|
||||||
@@ -994,6 +1015,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for previewing multiple matching tags
|
" Test for previewing multiple matching tags
|
||||||
func Test_preview_tag_multimatch()
|
func Test_preview_tag_multimatch()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo\t1",
|
\ "first\tXfoo\t1",
|
||||||
@@ -1042,6 +1066,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for jumping to multiple matching tags across multiple :tags commands
|
" Test for jumping to multiple matching tags across multiple :tags commands
|
||||||
func Test_tnext_multimatch()
|
func Test_tnext_multimatch()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo1\t1",
|
\ "first\tXfoo1\t1",
|
||||||
@@ -1069,6 +1096,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for jumping to multiple matching tags in non-existing files
|
" Test for jumping to multiple matching tags in non-existing files
|
||||||
func Test_multimatch_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([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo1\t1",
|
\ "first\tXfoo1\t1",
|
||||||
@@ -1086,6 +1116,9 @@ func Test_multimatch_non_existing_files()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_tselect_listing()
|
func Test_tselect_listing()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
call writefile([
|
call writefile([
|
||||||
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
\ "!_TAG_FILE_ENCODING\tutf-8\t//",
|
||||||
\ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
|
\ "first\tXfoo\t1" .. ';"' .. "\tv\ttyperef:typename:int\tfile:",
|
||||||
@@ -1467,6 +1500,9 @@ endfunc
|
|||||||
|
|
||||||
" Test for 'tagbsearch' (binary search)
|
" Test for 'tagbsearch' (binary search)
|
||||||
func Test_tagbsearch()
|
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
|
" 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.
|
" unsorted, then binary search should fail and linear search should work.
|
||||||
call writefile([
|
call writefile([
|
||||||
|
@@ -638,6 +638,9 @@ endfunc
|
|||||||
|
|
||||||
" Test $buf delcmd {cmd} (command executed when buffer is deleted)
|
" Test $buf delcmd {cmd} (command executed when buffer is deleted)
|
||||||
func Test_buffer_delcmd()
|
func Test_buffer_delcmd()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
new Xfoo
|
new Xfoo
|
||||||
split
|
split
|
||||||
tcl $::vim::current(buffer) delcmd [list set msg "buffer deleted"]
|
tcl $::vim::current(buffer) delcmd [list set msg "buffer deleted"]
|
||||||
|
@@ -665,6 +665,9 @@ func Test_term_mouse_click_tab()
|
|||||||
set mouse=a term=xterm
|
set mouse=a term=xterm
|
||||||
call WaitForResponses()
|
call WaitForResponses()
|
||||||
|
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
let row = 1
|
let row = 1
|
||||||
|
|
||||||
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
|
for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec + g:Ttymouse_netterm
|
||||||
|
@@ -137,6 +137,8 @@ endfunc
|
|||||||
|
|
||||||
" Test the ":wincmd ^" and "<C-W>^" commands.
|
" Test the ":wincmd ^" and "<C-W>^" commands.
|
||||||
func Test_window_split_edit_alternate()
|
func Test_window_split_edit_alternate()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
" Test for failure when the alternate buffer/file no longer exists.
|
" Test for failure when the alternate buffer/file no longer exists.
|
||||||
edit Xfoo | %bw
|
edit Xfoo | %bw
|
||||||
@@ -170,6 +172,8 @@ endfunc
|
|||||||
|
|
||||||
" Test the ":[count]wincmd ^" and "[count]<C-W>^" commands.
|
" Test the ":[count]wincmd ^" and "[count]<C-W>^" commands.
|
||||||
func Test_window_split_edit_bufnr()
|
func Test_window_split_edit_bufnr()
|
||||||
|
" in case a previous failure left a swap file behind
|
||||||
|
call delete('.Xfoo.swp')
|
||||||
|
|
||||||
%bwipeout
|
%bwipeout
|
||||||
let l:nr = bufnr('%') + 1
|
let l:nr = bufnr('%') + 1
|
||||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1005,
|
||||||
/**/
|
/**/
|
||||||
1004,
|
1004,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user