1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:20:04 +08:00
SpaceVim/bundle/vim-textobj-user/t/script-local.vim
2020-06-13 14:06:35 +08:00

39 lines
796 B
VimL

call vspec#hint({'sid': 'textobj#user#_sid()'})
let s:counter = [0]
function! s:increment()
let s:counter[0] += 1
return 0
endfunction
call textobj#user#plugin('dummy', {
\ '-': {
\ '*sfile*': expand('<sfile>:p'),
\ '*select-function*': 's:increment',
\ 'select': ['ad', 'id'],
\ },
\ })
describe '*sfile*'
it 'can call a script-local function'
let c = s:counter
Expect c[0] == 0
execute 'normal' "vid\<Esc>"
Expect c[0] == 1
execute 'normal' "vad\<Esc>"
Expect c[0] == 2
end
end
describe 's:normalize_path'
it 'normalizes a backslashed path into a forwardslashed path'
Expect Call(
\ 's:normalize_path',
\ '/c/Users/who\vimfiles\plugin\textobj\foo.vim'
\ ) ==# '/c/Users/who/vimfiles/plugin/textobj/foo.vim'
end
end