Skip to content

Commit 89d9fe8

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

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/all.vimspec

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,33 @@ 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+
Assert Equal(getreg(v:register), 'foo')
254+
255+
normal c
256+
257+
let lines = getline(1, '$')
258+
let commit = lines[2]
259+
let hash = matchstr(commit, '^ Commit: \+\zs[[:xdigit:]]\{7,}$')
260+
Assert Equal(getreg(v:register), hash)
261+
262+
" Confirm also works after moving to a different commit
263+
normal o
264+
normal c
265+
266+
let lines = getline(1, '$')
267+
let commit = lines[2]
268+
let hash = matchstr(commit, '^ Commit: \+\zs[[:xdigit:]]\{7,}$')
269+
Assert Equal(getreg(v:register), hash)
270+
End
271+
245272
It does not cause #23 again
246273
" 1. Open the same buffer with multiple window
247274
" 2. Move cursror to the second window which opens the same

0 commit comments

Comments
 (0)