Permalink
Browse files

Add yank_hash action to giti/log kind

  • Loading branch information...
1 parent ce7d696 commit 7c64ccfe2483837f040cf7373f1d5ba85086073c @kmnk committed Mar 18, 2013
Showing with 32 additions and 0 deletions.
  1. +11 −0 autoload/unite/kinds/giti/log.vim
  2. +21 −0 test/autoload/unite/kinds/giti/test_log.vim
@@ -148,6 +148,17 @@ function! s:kind.action_table.reset_hard.func(candidate)"{{{
endfunction"}}}
let s:kind.alias_table.reset_hard = 'reset'
+let s:kind.action_table.yank_hash = {
+\ 'description' : 'yank hash of this commit',
+\ 'is_selectable' : 0,
+\ 'is_quit' : 1,
+\ 'is_invalidate_cache' : 0,
+\ 'is_listed' : 1,
+\}
+function! s:kind.action_table.yank_hash.func(candidate)"{{{
+ let @" = a:candidate.action__data.hash
+endfunction"}}}
+
" }}}
" local functions {{{
@@ -211,6 +211,27 @@ function! s:tc.test_kind_action_reset_hard()"{{{
\ )
endfunction"}}}
+function! s:tc.test_action_yank_hash()"{{{
+ let kind = self.get('s:kind')
+ let yank_hash = kind.action_table.yank_hash
+ call self.assert_equal(type({}), type(yank_hash))
+ call self.assert_equal(type(''), type(yank_hash.description))
+ call self.assert_equal(yank_hash.is_selectable, 0)
+ call self.assert_equal(yank_hash.is_quit, 1)
+ call self.assert_equal(yank_hash.is_invalidate_cache, 0)
+ call self.assert_equal(type(function('tr')), type(yank_hash.func))
+
+ let candidate = {
+\ "action__data" : {
+\ "hash" : "hoge",
+\ },
+\ }
+ let @" = 'fuga'
+ call self.assert_not_equal(candidate.action__data.hash, @")
+ call yank_hash.func(candidate)
+ call self.assert_equal(candidate.action__data.hash, @")
+endfunction"}}}
+
function! s:tc.test_kind_alias_table_has()"{{{
let kind = self.get('s:kind')
let table = kind.alias_table

0 comments on commit 7c64ccf

Please sign in to comment.