From cbc62124aea495c934e7781a633323fa85181572 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 23 Jan 2014 16:26:45 +0900 Subject: [PATCH] Test: add test case for off-screen search --- t/easymotion_spec.vim | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/t/easymotion_spec.vim b/t/easymotion_spec.vim index 06995a5..4d5891c 100644 --- a/t/easymotion_spec.vim +++ b/t/easymotion_spec.vim @@ -1206,4 +1206,111 @@ describe 'bi-directional t motion' end "}}} +" off-screen search {{{ +describe 'off-screen search' + before + new + let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + let g:EasyMotion_off_screen_search = 1 + map s/ (easymotion-sn) + map f/ (easymotion-fn) + map F/ (easymotion-Fn) + map t/ (easymotion-tn) + map T/ (easymotion-Tn) + call EasyMotion#init() + call AddLine('deco-chan deco-chan') + call AddLine('vim') + for i in range(50) + call AddLine('poge1 2huga 3hiyo 4poyo') + endfor + " 12345678901234567890123 + end + + after + let g:EasyMotion_off_screen_search = 0 + close! + end + + " provide search with off-screen range {{{ + it 'provide search with off-screen range' + normal! gg0 + let l = line('.') + Expect CursorPos() == [l,1,'p'] + + exec "normal s/vim\" + Expect CursorPos() == [51,1,'v'] + + normal! gg0 + exec "normal f/im\" + Expect CursorPos() == [51,2,'i'] + + set wrapscan + Expect &wrapscan == 1 + normal! gg0 + exec "normal F/im\" + Expect CursorPos() == [51,2,'i'] + + " Cancel + normal! gg0 + exec "normal s/vim\" + Expect CursorPos() == [l,1,'p'] + + " Label + normal! gg0 + exec "normal s/deco-chan\\" + Expect CursorPos() == [l,1,'p'] + + normal! gg0 + exec "normal s/deco-chan\a" + Expect CursorPos() == [52,1,'d'] + + normal! gg0 + exec "normal s/deco-chan\b" + Expect CursorPos() == [52,11,'d'] + + normal! gg0 + exec "normal t/chan\a" + Expect CursorPos() == [52,5,'-'] + + normal! gg0 + exec "normal t/chan\b" + Expect CursorPos() == [52,15,'-'] + + end + "}}} +end + +describe 'dot notoff-screen search' "{{{ + before + new + let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + let g:EasyMotion_off_screen_search = 0 + map s/ (easymotion-sn) + call EasyMotion#init() + call AddLine('deco-chan deco-chan') + call AddLine('vim') + for i in range(50) + call AddLine('poge1 2huga 3hiyo 4poyo') + endfor + " 12345678901234567890123 + end + + after + close! + end + + " provide search with off-screen range {{{ + it 'provide search with off-screen range' + normal! gg0 + let l = line('.') + Expect CursorPos() == [l,1,'p'] + + exec "normal s/vim\" + Expect CursorPos() != [51,1,'v'] + Expect CursorPos() == [l,1,'p'] + end + "}}} +end "}}} +"}}} + " vim: fdm=marker:et:ts=4:sw=4:sts=4