Skip to content

Commit

Permalink
add tests for markers consisting of more than 7 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysd committed May 20, 2024
1 parent 0b6710b commit fbde49c
Showing 1 changed file with 75 additions and 8 deletions.
83 changes: 75 additions & 8 deletions test/test_jump.vimspec
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@ let s:lines_diff3 = [

lockvar s:lines_diff3

let s:lines_long_markers = [
\ '',
\ '<<<<<<<<<<<<<< HEAD',
\ 'ourselves1',
\ '==============',
\ 'themselves1',
\ '>>>>>>>>>>>>>> 8374eabc232',
\ '',
\ '',
\ '<<<<<<<< HEAD',
\ 'ourselves2',
\ '========',
\ 'themselves2',
\ '>>>>>>>> 8374eabc232',
\ '',
\ ]

lockvar s:lines_long_markers

function! s:setup(lines) abort
new
for l in range(1, len(a:lines))
Expand All @@ -81,13 +100,13 @@ Describe :ConflictMarkerNextHunk
endfor
End

It doesn''t move cursor at the end of buffer
It doesn't move cursor at the end of buffer
normal! G
ConflictMarkerNextHunk
Assert Equals(line('.'), line('$'))
End

It doesn''t accept at cursor
It doesn't accept at cursor
normal! ggj
ConflictMarkerNextHunk
Assert Equals(line('.'), 9)
Expand Down Expand Up @@ -117,13 +136,13 @@ Describe :ConflictMarkerNextHunk
endfor
End

It doesn''t move cursor at the end of buffer
It doesn't move cursor at the end of buffer
normal! G
ConflictMarkerNextHunk
Assert Equals(line('.'), line('$'))
End

It doesn''t accept at cursor
It doesn't accept at cursor
normal! ggj
ConflictMarkerNextHunk
Assert Equals(line('.'), 11)
Expand All @@ -135,6 +154,30 @@ Describe :ConflictMarkerNextHunk
Assert Equals(line('.'), 2)
End
End

Context markers with more than 7 characters
Before
call s:setup(s:lines_long_markers)
End

After
close!
End

It moves cursor to next hunk
normal! gg
for l in [2, 9]
ConflictMarkerNextHunk
Assert Equals(line('.'), l)
endfor
End

It accepts at cursor with bang
normal! ggj
ConflictMarkerNextHunk!
Assert Equals(line('.'), 2)
End
End
End

Describe :ConflictMarkerPrevHunk
Expand All @@ -155,13 +198,13 @@ Describe :ConflictMarkerPrevHunk
endfor
End

It doesn''t move cursor at the top of buffer
It doesn't move cursor at the top of buffer
normal! gg
ConflictMarkerPrevHunk
Assert Equals(line('.'), 1)
End

It doesn''t accept at cursor
It doesn't accept at cursor
normal! Gk
ConflictMarkerPrevHunk
Assert Equals(line('.'), 9)
Expand Down Expand Up @@ -191,13 +234,13 @@ Describe :ConflictMarkerPrevHunk
endfor
End

It doesn''t move cursor at the top of buffer
It doesn't move cursor at the top of buffer
normal! gg
ConflictMarkerPrevHunk
Assert Equals(line('.'), 1)
End

It doesn''t accept at cursor
It doesn't accept at cursor
normal! Gk
ConflictMarkerPrevHunk
Assert Equals(line('.'), 11)
Expand All @@ -209,4 +252,28 @@ Describe :ConflictMarkerPrevHunk
Assert Equals(line('.'), 20)
End
End

Context markers with more than 7 characters
Before
call s:setup(s:lines_long_markers)
End

After
close!
End

It move cursor to previous hunk
normal! G
for l in [9, 2]
ConflictMarkerPrevHunk
Assert Equals(line('.'), l)
endfor
End

It accepts at cursor with bang
normal! Gk
ConflictMarkerPrevHunk!
Assert Equals(line('.'), 9)
End
End
End

0 comments on commit fbde49c

Please sign in to comment.