replace function names starting with g: to CamelCase (fix #326)

This commit is contained in:
itchyny
2014-11-30 10:01:04 +09:00
parent 10cd4c6cfb
commit 6cc1d8c34a
3 changed files with 18 additions and 18 deletions

View File

@@ -63,7 +63,7 @@ describe 'goto_with_tabs'
Expect col('.') == 8 Expect col('.') == 8
silent normal G\d silent normal G\d
Expect g:current_buffer_is_module('subprocess') == 1 Expect CurrentBufferIsModule('subprocess') == 1
Expect line('.') == 1 Expect line('.') == 1
Expect col('.') == 1 Expect col('.') == 1
Expect tabpagenr('$') == 2 Expect tabpagenr('$') == 2
@@ -75,19 +75,19 @@ describe 'goto_with_tabs'
it 'multi_definitions' it 'multi_definitions'
put = ['import tokenize'] put = ['import tokenize']
silent normal G$\d silent normal G$\d
Expect g:current_buffer_is_module('tokenize') == 0 Expect CurrentBufferIsModule('tokenize') == 0
Expect g:current_buffer_is_module('token') == 0 Expect CurrentBufferIsModule('token') == 0
execute "normal \<CR>" execute "normal \<CR>"
Expect tabpagenr('$') == 2 Expect tabpagenr('$') == 2
Expect winnr('$') == 1 Expect winnr('$') == 1
Expect g:current_buffer_is_module('token') == 1 Expect CurrentBufferIsModule('token') == 1
bd bd
silent normal G$\d silent normal G$\d
execute "normal j\<CR>" execute "normal j\<CR>"
Expect tabpagenr('$') == 2 Expect tabpagenr('$') == 2
Expect winnr('$') == 1 Expect winnr('$') == 1
Expect g:current_buffer_is_module('tokenize') == 1 Expect CurrentBufferIsModule('tokenize') == 1
end end
end end
@@ -109,12 +109,12 @@ describe 'goto_with_buffers'
normal G$ normal G$
call jedi#goto_assignments() call jedi#goto_assignments()
python jedi_vim.goto() 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 " Without hidden, it's not possible to open a new buffer, when the old
" one is not saved. " one is not saved.
set hidden set hidden
call jedi#goto_assignments() call jedi#goto_assignments()
Expect g:current_buffer_is_module('os') == 1 Expect CurrentBufferIsModule('os') == 1
Expect winnr('$') == 1 Expect winnr('$') == 1
Expect tabpagenr('$') == 1 Expect tabpagenr('$') == 1
Expect line('.') == 1 Expect line('.') == 1
@@ -125,19 +125,19 @@ describe 'goto_with_buffers'
set hidden set hidden
put = ['import tokenize'] put = ['import tokenize']
silent normal G$\d silent normal G$\d
Expect g:current_buffer_is_module('tokenize') == 0 Expect CurrentBufferIsModule('tokenize') == 0
Expect g:current_buffer_is_module('token') == 0 Expect CurrentBufferIsModule('token') == 0
execute "normal \<CR>" execute "normal \<CR>"
Expect tabpagenr('$') == 1 Expect tabpagenr('$') == 1
Expect winnr('$') == 1 Expect winnr('$') == 1
Expect g:current_buffer_is_module('token') == 1 Expect CurrentBufferIsModule('token') == 1
bd bd
silent normal G$\d silent normal G$\d
execute "normal j\<CR>" execute "normal j\<CR>"
Expect tabpagenr('$') == 1 Expect tabpagenr('$') == 1
Expect winnr('$') == 1 Expect winnr('$') == 1
Expect g:current_buffer_is_module('tokenize') == 1 Expect CurrentBufferIsModule('tokenize') == 1
end end
end end
@@ -162,7 +162,7 @@ describe 'goto_with_splits'
Expect col('.') == 8 Expect col('.') == 8
silent normal G\d silent normal G\d
Expect g:current_buffer_is_module('subprocess') == 1 Expect CurrentBufferIsModule('subprocess') == 1
Expect line('.') == 1 Expect line('.') == 1
Expect col('.') == 1 Expect col('.') == 1
Expect winnr('$') == 2 Expect winnr('$') == 2

View File

@@ -9,9 +9,9 @@ describe 'pyimport'
it 'open_tab' it 'open_tab'
Pyimport os Pyimport os
Expect g:current_buffer_is_module('os') == 1 Expect CurrentBufferIsModule('os') == 1
Pyimport subprocess Pyimport subprocess
Expect g:current_buffer_is_module('subprocess') == 1 Expect CurrentBufferIsModule('subprocess') == 1
" the empty tab is sometimes also a tab " the empty tab is sometimes also a tab
Expect tabpagenr('$') >= 2 Expect tabpagenr('$') >= 2
end end
@@ -19,7 +19,7 @@ describe 'pyimport'
it 'completion' it 'completion'
" don't know how to test this directly " don't know how to test this directly
"execute "Pyimport subproc\<Tab>" "execute "Pyimport subproc\<Tab>"
"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('subproc', 0, 0) == 'subprocess'
Expect jedi#py_import_completions('subprocess', 0, 0) == 'subprocess' Expect jedi#py_import_completions('subprocess', 0, 0) == 'subprocess'

View File

@@ -1,9 +1,9 @@
function! g:current_buffer_is_module(module_name) function! CurrentBufferIsModule(module_name)
return g:ends_with(bufname('%'), a:module_name.'.py') return EndsWith(bufname('%'), a:module_name.'.py')
endfunction endfunction
function g:ends_with(string, end) function EndsWith(string, end)
let l:should = len(a:string) - strlen(a:end) let l:should = len(a:string) - strlen(a:end)
return l:should == stridx(a:string, a:end, should) return l:should == stridx(a:string, a:end, should)
endfunction endfunction