| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- scriptencoding utf-8
- Describe basic_asterisk
- Before all
- let lines = [
- \ '1.asterisk 2.asterisk 3.asterisk'
- \ , '4.Asterisk 5.AsteRisK 6.Asterisk'
- \ , ''
- \ , '7.アスタリスク 8.アスタリスクです 9.アスタリスク?'
- \ , '.* .* .*'
- \ , '.* asterisk asterisk'
- \ ]
- call g:Add_lines(lines)
- End
- Before each
- call cursor([1, 1])
- normal! 2l
- End
- After all
- :1,$ delete
- End
- Context *
- It search forward with \<\>
- let @/ = ''
- normal *
- Assert Equals(@/, '\<asterisk\>')
- End
- It search forward the 1th occurrence of the word
- normal *
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search forward the 2th occurrence of the word
- normal 2*
- normal! 2h
- Assert Equals(g:Get_pos_char(), '3')
- End
- It search forward in the middle of word
- normal! l
- normal *
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search forward multibyte word
- normal! 3j
- normal *
- normal! B
- Assert Equals(g:Get_pos_char(), '8')
- End
- It throws the error if there are no <cword>
- normal! 2j
- Throws /E348: No string under cursor/ :normal *
- End
- Context regular expression handling
- It use regular expression characters under cursor if there are no keyword word after them
- normal! 4j0
- normal *
- Assert Equals(@/, '\.\*')
- End
- It do not use regular expression characters under cursor if there are keyword words after them
- normal! 5j0
- normal *
- Assert Equals(@/, '\<asterisk\>')
- End
- End
- End
- Context g*
- It search forward without \<\>
- let @/ = ''
- normal g*
- Assert Equals(@/, 'asterisk')
- End
- It search forward the 1th occurrence of the word
- normal g*
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search forward the 2th occurrence of the word
- normal 2*
- normal! 2h
- Assert Equals(g:Get_pos_char(), '3')
- End
- It search forward in the middle of word
- normal! l
- normal g*
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It throws the error if there are no <cword>
- normal! 2j
- Throws /E348: No string under cursor/ :normal g*
- End
- It search forward with the first keyword after the cursor
- normal! h
- normal *
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search forward with ignorecase
- set ignorecase nosmartcase
- normal! j
- normal *
- normal! 2h
- Assert Equals(g:Get_pos_char(), '5')
- set ignorecase& smartcase&
- End
- It search forward with smartcase
- set ignorecase smartcase
- normal! j
- normal *
- normal! 2h
- Assert Equals(g:Get_pos_char(), '6')
- set ignorecase& smartcase&
- End
- End
- Context #
- It search backward with \<\>
- let @/ = ''
- normal #
- Assert Equals(@/, '\<asterisk\>')
- End
- It search backward the 1th occurrence of the word
- normal! $b
- normal #
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search backward the 2th occurrence of the word
- normal! $b
- normal 2#
- normal! 2h
- Assert Equals(g:Get_pos_char(), '1')
- End
- It search backward at the end of word
- normal! $
- normal #
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search backward in the middle of word
- normal! $h
- normal #
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- It search backward with the first keyword after the cursor
- normal! $bh
- normal #
- normal! 2h
- Assert Equals(g:Get_pos_char(), '2')
- End
- End
- Context g#
- It search backward with \<\>
- let @/ = ''
- normal g#
- Assert Equals(@/, 'asterisk')
- End
- End
- End
|