forked from aniani/vim
patch 9.0.0363: common names in test files causes tests to be flaky
Problem: Common names in test files causes tests to be flaky. Solution: Use more specific names.
This commit is contained in:
@@ -1762,11 +1762,11 @@ func Test_python3_buffer()
|
||||
%bw!
|
||||
|
||||
" Range object for a deleted buffer
|
||||
new Xfile
|
||||
new Xp3buffile
|
||||
call setline(1, ['one', 'two', 'three'])
|
||||
py3 b = vim.current.buffer
|
||||
py3 r = vim.current.buffer.range(0, 2)
|
||||
call assert_equal('<range Xfile (0:2)>', py3eval('repr(r)'))
|
||||
call assert_equal('<range Xp3buffile (0:2)>', py3eval('repr(r)'))
|
||||
%bw!
|
||||
call AssertException(['py3 r[:] = []'],
|
||||
\ 'Vim(py3):vim.error: attempt to refer to deleted buffer')
|
||||
@@ -1795,7 +1795,7 @@ endfunc
|
||||
" Test vim.buffers object
|
||||
func Test_python3_buffers()
|
||||
%bw!
|
||||
edit Xfile
|
||||
edit Xp3buffile
|
||||
py3 cb = vim.current.buffer
|
||||
set hidden
|
||||
edit a
|
||||
@@ -1819,8 +1819,8 @@ func Test_python3_buffers()
|
||||
cb.append('i3:' + str(next(i3)))
|
||||
del i3
|
||||
EOF
|
||||
call assert_equal(['i:<buffer Xfile>',
|
||||
\ 'i2:<buffer Xfile>', 'i:<buffer a>', 'i3:<buffer Xfile>'],
|
||||
call assert_equal(['i:<buffer Xp3buffile>',
|
||||
\ 'i2:<buffer Xp3buffile>', 'i:<buffer a>', 'i3:<buffer Xp3buffile>'],
|
||||
\ getline(2, '$'))
|
||||
%d
|
||||
|
||||
@@ -1838,7 +1838,7 @@ func Test_python3_buffers()
|
||||
|
||||
cb.append(str(len(vim.buffers)))
|
||||
EOF
|
||||
call assert_equal([bufnr('Xfile') .. ':<buffer Xfile>=<buffer Xfile>',
|
||||
call assert_equal([bufnr('Xp3buffile') .. ':<buffer Xp3buffile>=<buffer Xp3buffile>',
|
||||
\ bufnr('a') .. ':<buffer a>=<buffer a>',
|
||||
\ bufnr('b') .. ':<buffer b>=<buffer b>',
|
||||
\ bufnr('c') .. ':<buffer c>=<buffer c>', '4'], getline(2, '$'))
|
||||
@@ -1868,15 +1868,15 @@ func Test_python3_buffers()
|
||||
del i4
|
||||
del bnums
|
||||
EOF
|
||||
call assert_equal(['i4:<buffer Xfile>',
|
||||
\ 'i4:<buffer Xfile>', 'StopIteration'], getline(2, '$'))
|
||||
call assert_equal(['i4:<buffer Xp3buffile>',
|
||||
\ 'i4:<buffer Xp3buffile>', 'StopIteration'], getline(2, '$'))
|
||||
%bw!
|
||||
endfunc
|
||||
|
||||
" Test vim.{tabpage,window}list and vim.{tabpage,window} objects
|
||||
func Test_python3_tabpage_window()
|
||||
%bw
|
||||
edit Xfile
|
||||
edit Xp3buffile
|
||||
py3 cb = vim.current.buffer
|
||||
tabnew 0
|
||||
tabnew 1
|
||||
@@ -1937,7 +1937,7 @@ func Test_python3_tabpage_window()
|
||||
Current tab pages:
|
||||
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
|
||||
Windows:
|
||||
<window object (unknown)>(1): displays buffer <buffer Xfile>; cursor is at (2, 0)
|
||||
<window object (unknown)>(1): displays buffer <buffer Xp3buffile>; cursor is at (2, 0)
|
||||
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
|
||||
Windows:
|
||||
<window object (unknown)>(1): displays buffer <buffer 0>; cursor is at (1, 0)
|
||||
@@ -1953,14 +1953,14 @@ func Test_python3_tabpage_window()
|
||||
<window 3>(4): displays buffer <buffer 2>; cursor is at (1, 0)
|
||||
Number of windows in current tab page: 4
|
||||
END
|
||||
call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$'))
|
||||
call assert_equal(expected, getbufline(bufnr('Xp3buffile'), 2, '$'))
|
||||
%bw!
|
||||
endfunc
|
||||
|
||||
" Test vim.current
|
||||
func Test_python3_vim_current()
|
||||
%bw
|
||||
edit Xfile
|
||||
edit Xpy3cfile
|
||||
py3 cb = vim.current.buffer
|
||||
tabnew 0
|
||||
tabnew 1
|
||||
@@ -1986,8 +1986,8 @@ func Test_python3_vim_current()
|
||||
Current window: <window 0>: <window 0> is <window 0>
|
||||
Current buffer: <buffer c.2>: <buffer c.2> is <buffer c.2> is <buffer c.2>
|
||||
END
|
||||
call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$'))
|
||||
call deletebufline(bufnr('Xfile'), 1, '$')
|
||||
call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$'))
|
||||
call deletebufline(bufnr('Xpy3cfile'), 1, '$')
|
||||
|
||||
" Assigning: fails
|
||||
py3 << trim EOF
|
||||
@@ -2010,10 +2010,10 @@ func Test_python3_vim_current()
|
||||
Type error at assigning None to vim.current.tabpage
|
||||
Type error at assigning None to vim.current.buffer
|
||||
END
|
||||
call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$'))
|
||||
call deletebufline(bufnr('Xfile'), 1, '$')
|
||||
call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$'))
|
||||
call deletebufline(bufnr('Xpy3cfile'), 1, '$')
|
||||
|
||||
call setbufline(bufnr('Xfile'), 1, 'python interface')
|
||||
call setbufline(bufnr('Xpy3cfile'), 1, 'python interface')
|
||||
py3 << trim EOF
|
||||
# Assigning: success
|
||||
vim.current.tabpage = vim.tabpages[-2]
|
||||
@@ -2029,13 +2029,13 @@ func Test_python3_vim_current()
|
||||
let expected =<< trim END
|
||||
Current tab page: <tabpage 2>
|
||||
Current window: <window 0>
|
||||
Current buffer: <buffer Xfile>
|
||||
Current buffer: <buffer Xpy3cfile>
|
||||
Current line: 'python interface'
|
||||
END
|
||||
call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$'))
|
||||
call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$'))
|
||||
py3 vim.current.line = 'one line'
|
||||
call assert_equal('one line', getline('.'))
|
||||
call deletebufline(bufnr('Xfile'), 1, '$')
|
||||
call deletebufline(bufnr('Xpy3cfile'), 1, '$')
|
||||
|
||||
py3 << trim EOF
|
||||
ws = list(vim.windows)
|
||||
@@ -2055,7 +2055,7 @@ func Test_python3_vim_current()
|
||||
w.valid: [True, False]
|
||||
t.valid: [True, False, True, False]
|
||||
END
|
||||
call assert_equal(expected, getbufline(bufnr('Xfile'), 2, '$'))
|
||||
call assert_equal(expected, getbufline(bufnr('Xpy3cfile'), 2, '$'))
|
||||
%bw!
|
||||
endfunc
|
||||
|
||||
@@ -2598,7 +2598,7 @@ endfunc
|
||||
|
||||
" Test chdir
|
||||
func Test_python3_chdir()
|
||||
new Xfile
|
||||
new Xp3cdfile
|
||||
py3 cb = vim.current.buffer
|
||||
py3 << trim EOF
|
||||
import os
|
||||
@@ -2609,7 +2609,7 @@ func Test_python3_chdir()
|
||||
path = fnamemodify('.', ':p:h:t')
|
||||
if path != b'src' and path != b'src2':
|
||||
# Running tests from a shadow directory, so move up another level
|
||||
# This will result in @% looking like shadow/testdir/Xfile, hence the
|
||||
# This will result in @% looking like shadow/testdir/Xp3cdfile, hence the
|
||||
# slicing to remove the leading path and path separator
|
||||
os.chdir('..')
|
||||
cb.append(str(fnamemodify('.', ':p:h:t')))
|
||||
@@ -2625,8 +2625,8 @@ func Test_python3_chdir()
|
||||
cb.append(vim.eval('@%'))
|
||||
del fnamemodify
|
||||
EOF
|
||||
call assert_equal(["b'testdir'", 'Xfile', "b'src'", 'testdir/Xfile',
|
||||
\"b'testdir'", 'Xfile'], getline(2, '$'))
|
||||
call assert_equal(["b'testdir'", 'Xp3cdfile', "b'src'", 'testdir/Xp3cdfile',
|
||||
\"b'testdir'", 'Xp3cdfile'], getline(2, '$'))
|
||||
close!
|
||||
call AssertException(["py3 vim.chdir(None)"], "Vim(py3):TypeError:")
|
||||
endfunc
|
||||
|
||||
Reference in New Issue
Block a user