Add test for hunk staging.

This commit is contained in:
Andy Stewart
2014-11-13 15:21:37 +01:00
parent dd054534a0
commit 1f2bb48be5
4 changed files with 26 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ set runtimepath+=../
source ../plugin/gitgutter.vim
function! Setup()
call system('git reset HEAD fixture.txt')
call system('git checkout fixture.txt')
edit! fixture.txt
sign unplace *
@@ -13,3 +14,6 @@ function! DumpSigns(filename)
redir END
endfunction
function! DumpGitDiff(filename)
call system('git diff --staged fixture.txt > '.a:filename.'.out')
endfunction

13
test/hunkStageGitDiff.ok Normal file
View File

@@ -0,0 +1,13 @@
diff --git a/test/fixture.txt b/test/fixture.txt
index f5c6aff..ae8e546 100644
--- a/test/fixture.txt
+++ b/test/fixture.txt
@@ -2,7 +2,7 @@ a
b
c
d
-e
+*e
f
g
h

2
test/hunkStageSigns.ok Normal file
View File

@@ -0,0 +1,2 @@
--- Signs ---

7
test/testHunkStage.vim Normal file
View File

@@ -0,0 +1,7 @@
source helper.vim
call Setup()
normal 5Gi*
execute 'GitGutterStageHunk'
call DumpSigns('hunkStageSigns')
call DumpGitDiff('hunkStageGitDiff')