Add test for staging subsequent nearby hunk.

This commit is contained in:
Andy Stewart
2015-03-05 11:43:39 +01:00
parent 65f03a6fd5
commit 05030aa565
5 changed files with 46 additions and 0 deletions

View File

@@ -12,6 +12,11 @@ function! DumpSigns(filename)
redir END redir END
endfunction endfunction
function! DumpGitDiff(filename)
call system('git diff fixture.txt > '.a:filename.'.actual')
endfunction
function! DumpGitDiffStaged(filename) function! DumpGitDiffStaged(filename)
call system('git diff --staged fixture.txt > '.a:filename.'.actual') call system('git diff --staged fixture.txt > '.a:filename.'.actual')
endfunction endfunction

View File

@@ -0,0 +1,13 @@
diff --git a/test/fixture.txt b/test/fixture.txt
index 53b13df..8fdfda7 100644
--- a/test/fixture.txt
+++ b/test/fixture.txt
@@ -1,5 +1,8 @@
a
b
+x
+y
+z
c
e
f

View File

@@ -0,0 +1,12 @@
diff --git a/test/fixture.txt b/test/fixture.txt
index f5c6aff..53b13df 100644
--- a/test/fixture.txt
+++ b/test/fixture.txt
@@ -1,7 +1,6 @@
a
b
c
-d
e
f
g

View File

@@ -0,0 +1,6 @@
--- Signs ---
Signs for fixture.txt:
line=3 id=3000 name=GitGutterLineAdded
line=4 id=3001 name=GitGutterLineAdded
line=5 id=3002 name=GitGutterLineAdded

View File

@@ -0,0 +1,10 @@
source helper.vim
call Setup()
execute "normal! 2Gox\<CR>y\<CR>z"
normal 2jdd
normal k
execute 'GitGutterStageHunk'
call DumpSigns('hunkStageNearbySigns')
call DumpGitDiff('hunkStageNearbyGitDiff')
call DumpGitDiffStaged('hunkStageNearbyGitDiffStaged')