Refactor code for testing
This commit is contained in:
parent
ca8f61644c
commit
afc8d860f6
@ -36,9 +36,12 @@ nnoremap <silent> <Plug>(repl-run) :<C-u>call repl#run_repl()<CR>
|
||||
"-------------------"
|
||||
|
||||
" Define default keymappings
|
||||
if !exists('g:repl_no_default_keymappings') || !g:repl_no_default_keymappings
|
||||
nmap <space>i <Plug>(repl-run)
|
||||
endif
|
||||
function! s:define_default_keymappings()
|
||||
if !exists('g:repl_no_default_keymappings') || !g:repl_no_default_keymappings
|
||||
nmap <leader>i <Plug>(repl-run)
|
||||
endif
|
||||
endfunction
|
||||
call s:define_default_keymappings()
|
||||
|
||||
"-------------------"
|
||||
let &cpo = s:save_cpo
|
||||
|
@ -8,5 +8,6 @@ call themis#option('runtimepath', expand('~/.vim/bundle/vimshell.vim'))
|
||||
" Util Functions
|
||||
function! UnletReplUserVariables() abort
|
||||
unlet! g:repl_filetype_repl
|
||||
unlet! g:repl_no_default_keymappings
|
||||
unlet! g:repl_split_command
|
||||
endfunction
|
||||
|
@ -1,5 +1,6 @@
|
||||
let s:suite = themis#suite('variable')
|
||||
let s:assert = themis#helper('assert')
|
||||
let s:scope = themis#helper('scope')
|
||||
|
||||
function! s:suite.after_each()
|
||||
call UnletReplUserVariables()
|
||||
@ -30,3 +31,19 @@ function! s:suite.g_repl_filetype_repl_is_valid()
|
||||
call s:assert.equals(l:filetype_repl['repl'], l:REPL_NAME)
|
||||
call s:assert.equals(l:filetype_repl['opt'], l:REPL_OPT)
|
||||
endfunction
|
||||
|
||||
"function! s:suite.g_repl_no_default_keymappings_is_valid_if_disabled()
|
||||
" " Case: g:repl_no_default_keymappings is undefined
|
||||
" let s:funcs = s:scope.funcs('plugin/repl.vim')
|
||||
" call s:funcs.define_default_keymappings()
|
||||
" call s:assert.true(hasmapto("\i", 'n'))
|
||||
" nunmap <leader>i
|
||||
"endfunction
|
||||
"
|
||||
"function! s:suite.g_repl_no_default_keymappings_is_valid_if_enabled()
|
||||
" " Case: g:repl_no_default_keymappings is defined to 1
|
||||
" let g:repl_no_default_keymappings = 1
|
||||
" let s:funcs = s:scope.funcs('plugin/repl.vim')
|
||||
" call s:funcs.define_default_keymappings()
|
||||
" call s:assert.false(hasmapto("\i", 'n'))
|
||||
"endfunction
|
||||
|
Reference in New Issue
Block a user