diff --git a/test/goto.vim b/test/goto.vim index 6163093..3d6a2ad 100644 --- a/test/goto.vim +++ b/test/goto.vim @@ -63,7 +63,7 @@ describe 'goto_with_tabs' Expect col('.') == 8 silent normal G\d - Expect g:current_buffer_is_module('subprocess') == 1 + Expect CurrentBufferIsModule('subprocess') == 1 Expect line('.') == 1 Expect col('.') == 1 Expect tabpagenr('$') == 2 @@ -75,19 +75,19 @@ describe 'goto_with_tabs' it 'multi_definitions' put = ['import tokenize'] silent normal G$\d - Expect g:current_buffer_is_module('tokenize') == 0 - Expect g:current_buffer_is_module('token') == 0 + Expect CurrentBufferIsModule('tokenize') == 0 + Expect CurrentBufferIsModule('token') == 0 execute "normal \" Expect tabpagenr('$') == 2 Expect winnr('$') == 1 - Expect g:current_buffer_is_module('token') == 1 + Expect CurrentBufferIsModule('token') == 1 bd silent normal G$\d execute "normal j\" Expect tabpagenr('$') == 2 Expect winnr('$') == 1 - Expect g:current_buffer_is_module('tokenize') == 1 + Expect CurrentBufferIsModule('tokenize') == 1 end end @@ -109,12 +109,12 @@ describe 'goto_with_buffers' normal G$ call jedi#goto_assignments() python jedi_vim.goto() - Expect g:current_buffer_is_module('os') == 0 + Expect CurrentBufferIsModule('os') == 0 " Without hidden, it's not possible to open a new buffer, when the old " one is not saved. set hidden call jedi#goto_assignments() - Expect g:current_buffer_is_module('os') == 1 + Expect CurrentBufferIsModule('os') == 1 Expect winnr('$') == 1 Expect tabpagenr('$') == 1 Expect line('.') == 1 @@ -125,19 +125,19 @@ describe 'goto_with_buffers' set hidden put = ['import tokenize'] silent normal G$\d - Expect g:current_buffer_is_module('tokenize') == 0 - Expect g:current_buffer_is_module('token') == 0 + Expect CurrentBufferIsModule('tokenize') == 0 + Expect CurrentBufferIsModule('token') == 0 execute "normal \" Expect tabpagenr('$') == 1 Expect winnr('$') == 1 - Expect g:current_buffer_is_module('token') == 1 + Expect CurrentBufferIsModule('token') == 1 bd silent normal G$\d execute "normal j\" Expect tabpagenr('$') == 1 Expect winnr('$') == 1 - Expect g:current_buffer_is_module('tokenize') == 1 + Expect CurrentBufferIsModule('tokenize') == 1 end end @@ -162,7 +162,7 @@ describe 'goto_with_splits' Expect col('.') == 8 silent normal G\d - Expect g:current_buffer_is_module('subprocess') == 1 + Expect CurrentBufferIsModule('subprocess') == 1 Expect line('.') == 1 Expect col('.') == 1 Expect winnr('$') == 2 diff --git a/test/pyimport.vim b/test/pyimport.vim index 9d48f87..eb7ca76 100644 --- a/test/pyimport.vim +++ b/test/pyimport.vim @@ -9,9 +9,9 @@ describe 'pyimport' it 'open_tab' Pyimport os - Expect g:current_buffer_is_module('os') == 1 + Expect CurrentBufferIsModule('os') == 1 Pyimport subprocess - Expect g:current_buffer_is_module('subprocess') == 1 + Expect CurrentBufferIsModule('subprocess') == 1 " the empty tab is sometimes also a tab Expect tabpagenr('$') >= 2 end @@ -19,7 +19,7 @@ describe 'pyimport' it 'completion' " don't know how to test this directly "execute "Pyimport subproc\" - "Expect g:current_buffer_is_module('subprocess') == 1 + "Expect CurrentBufferIsModule('subprocess') == 1 Expect jedi#py_import_completions('subproc', 0, 0) == 'subprocess' Expect jedi#py_import_completions('subprocess', 0, 0) == 'subprocess' diff --git a/test/utils.vim b/test/utils.vim index 2f2d823..5ad2a1d 100644 --- a/test/utils.vim +++ b/test/utils.vim @@ -1,9 +1,9 @@ -function! g:current_buffer_is_module(module_name) - return g:ends_with(bufname('%'), a:module_name.'.py') +function! CurrentBufferIsModule(module_name) + return EndsWith(bufname('%'), a:module_name.'.py') endfunction -function g:ends_with(string, end) +function EndsWith(string, end) let l:should = len(a:string) - strlen(a:end) return l:should == stridx(a:string, a:end, should) endfunction