Skip to content

Commit f4b912a

Browse files
committed
Add a test for new c mapping to yank commit hash
1 parent d0808e7 commit f4b912a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/all.vimspec

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,32 @@ Describe git-messenger.vim
242242
Assert True(found, 'Got line: ' . string(getline(2)))
243243
End
244244

245+
It yanks current commit on c
246+
GitMessenger
247+
Assert IsNotNone(GetPopup())
248+
249+
GitMessenger
250+
Assert Exists('b:__gitmessenger_popup')
251+
252+
call setreg(v:register, 'foo')
253+
254+
normal c
255+
256+
let lines = getline(1, '$')
257+
let commit = lines[2]
258+
let hash = matchstr(commit, '^ Commit: \+\zs[[:xdigit:]]\{7,}$')
259+
Assert Equal(getreg(v:register), hash)
260+
261+
" Confirm also works after moving to a different commit
262+
normal o
263+
normal c
264+
265+
let lines = getline(1, '$')
266+
let commit = lines[2]
267+
let hash = matchstr(commit, '^ Commit: \+\zs[[:xdigit:]]\{7,}$')
268+
Assert Equal(getreg(v:register), hash)
269+
End
270+
245271
It does not cause #23 again
246272
" 1. Open the same buffer with multiple window
247273
" 2. Move cursror to the second window which opens the same

0 commit comments

Comments
 (0)