Add test for surround-style keymappings

This commit is contained in:
machakann
2021-10-23 23:37:43 +09:00
parent b5bd9f42ed
commit b00d98d35a
2 changed files with 81 additions and 1 deletions

View File

@@ -14,4 +14,4 @@ before_script:
- chmod +x ./test/dot-repeat/test_dot.sh
script:
- ./vim-themis/bin/themis && ./test/dot-repeat/test_dot.sh
- ./vim-themis/bin/themis && ./vim-themis/bin/themis test/surround/test-surround.vim && ./test/dot-repeat/test_dot.sh

View File

@@ -0,0 +1,80 @@
scriptencoding utf-8
let s:suite = themis#suite('keymappings')
function! s:suite.before() abort "{{{
runtime macros/sandwich/keymap/surround.vim
endfunction "}}}
function! s:suite.before_each() abort "{{{
%delete
set filetype=
call operator#sandwich#set_default()
unlet! g:sandwich#recipes
unlet! g:operator#sandwich#recipes
endfunction
"}}}
function! s:suite.after() abort "{{{
call s:suite.before_each()
mapclear
unlet g:sandwich_no_default_key_mappings
unlet g:operator_sandwich_no_default_key_mappings
unlet g:textobj_sandwich_no_default_key_mappings
runtime plugin/sandwich.vim
runtime plugin/operator/sandwich.vim
runtime plugin/textobj/sandwich.vim
endfunction
"}}}
function! s:suite.surround() abort "{{{
call setline('.', 'foo')
normal 0ysiw(
call g:assert.equals(getline('.'), '(foo)', 'failed at #1')
call setline('.', 'foo bar')
normal 0yss(
call g:assert.equals(getline('.'), '(foo bar)', 'failed at #2')
call setline('.', 'foo bar')
normal 04lyS(
call g:assert.equals(getline('.'), 'foo (bar)', 'failed at #3')
call setline('.', '[(foo)]')
normal 02lds(
call g:assert.equals(getline('.'), '[foo]', 'failed at #4')
call setline('.', '[(foo)]')
normal 02lds[
call g:assert.equals(getline('.'), '(foo)', 'failed at #5')
call setline('.', '[(foo)]')
normal 02ldss
call g:assert.equals(getline('.'), '[foo]', 'failed at #6')
call setline('.', '"''foo''"')
normal 02ldss
call g:assert.equals(getline('.'), '"foo"', 'failed at #7')
call setline('.', '[(foo)]')
normal 02lcs({
call g:assert.equals(getline('.'), '[{foo}]', 'failed at #8')
call setline('.', '[(foo)]')
normal 02lcs[{
call g:assert.equals(getline('.'), '{(foo)}', 'failed at #9')
call setline('.', '[(foo)]')
normal 02lcss{
call g:assert.equals(getline('.'), '[{foo}]', 'failed at #10')
call setline('.', '"''foo''"')
normal 02lcss`
call g:assert.equals(getline('.'), '"`foo`"', 'failed at #11')
call setline('.', 'foo')
normal 0viwS(
call g:assert.equals(getline('.'), '(foo)', 'failed at #12')
endfunction "}}}
" vim:set foldmethod=marker:
" vim:set commentstring="%s: