HEX
Server: nginx/1.24.0
System: Linux prod-btpayments-io 6.14.0-1018-aws #18~24.04.1-Ubuntu SMP Mon Nov 24 19:46:27 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: //home/btminers/.vim/bundle/conflict-marker.vim/test/test_jump.vimspec
let s:lines = [
            \ '',
            \ '<<<<<<< HEAD',
            \ 'ourselves1',
            \ '=======',
            \ 'themselves1',
            \ '>>>>>>> 8374eabc232',
            \ '',
            \ '',
            \ '<<<<<<< HEAD',
            \ 'ourselves2',
            \ '=======',
            \ 'themselves2',
            \ '>>>>>>> 8374eabc232',
            \ '',
            \ '',
            \ '<<<<<<< HEAD',
            \ 'ourselves3',
            \ '=======',
            \ 'themselves3',
            \ '>>>>>>> 8374eabc232',
            \ '',
            \ ]

lockvar s:lines

let s:lines_diff3 = [
            \ '',
            \ '<<<<<<< HEAD',
            \ 'ourselves1',
            \ '|||||||',
            \ 'base1',
            \ '=======',
            \ 'themselves1',
            \ '>>>>>>> 8374eabc232',
            \ '',
            \ '',
            \ '<<<<<<< HEAD',
            \ 'ourselves2',
            \ '|||||||',
            \ 'base2',
            \ '=======',
            \ 'themselves2',
            \ '>>>>>>> 8374eabc232',
            \ '',
            \ '',
            \ '<<<<<<< HEAD',
            \ 'ourselves3',
            \ '|||||||',
            \ 'base3',
            \ '=======',
            \ 'themselves3',
            \ '>>>>>>> 8374eabc232',
            \ '',
            \ ]

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))
        call setline(l, a:lines[l-1])
    endfor
endfunction

Describe :ConflictMarkerNextHunk
    Context applying to diff2
        Before
            call s:setup(s:lines)
        End

        After
            close!
        End

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

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

        It doesn't accept at cursor
            normal! ggj
            ConflictMarkerNextHunk
            Assert Equals(line('.'), 9)
        End

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

    Context applying to diff3
        Before
            call s:setup(s:lines_diff3)
        End

        After
            close!
        End

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

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

        It doesn't accept at cursor
            normal! ggj
            ConflictMarkerNextHunk
            Assert Equals(line('.'), 11)
        End

        It accepts position at cursor with bang
            normal! ggj
            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 position at cursor with bang
            normal! ggj
            ConflictMarkerNextHunk!
            Assert Equals(line('.'), 2)
        End
    End
End

Describe :ConflictMarkerPrevHunk
    Context applying to diff2
        Before
            call s:setup(s:lines)
        End

        After
            close!
        End

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

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

        It doesn't accept at cursor
            normal! Gk
            ConflictMarkerPrevHunk
            Assert Equals(line('.'), 9)
        End

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

    Context applying to diff3
        Before
            call s:setup(s:lines_diff3)
        End

        After
            close!
        End

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

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

        It doesn't accept at cursor
            normal! Gk
            ConflictMarkerPrevHunk
            Assert Equals(line('.'), 11)
        End

        It accepts position at cursor with bang
            normal! Gk
            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 moves cursor to previous hunk
            normal! G
            for l in [9, 2]
                ConflictMarkerPrevHunk
                Assert Equals(line('.'), l)
            endfor
        End

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