diff --git a/test/helper.vim b/test/helper.vim index c633c4a..56929e2 100644 --- a/test/helper.vim +++ b/test/helper.vim @@ -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 diff --git a/test/hunkStageGitDiff.ok b/test/hunkStageGitDiff.ok new file mode 100644 index 0000000..6f6a7fa --- /dev/null +++ b/test/hunkStageGitDiff.ok @@ -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 diff --git a/test/hunkStageSigns.ok b/test/hunkStageSigns.ok new file mode 100644 index 0000000..aa8cd86 --- /dev/null +++ b/test/hunkStageSigns.ok @@ -0,0 +1,2 @@ + +--- Signs --- diff --git a/test/testHunkStage.vim b/test/testHunkStage.vim new file mode 100644 index 0000000..8bd84b5 --- /dev/null +++ b/test/testHunkStage.vim @@ -0,0 +1,7 @@ +source helper.vim +call Setup() + +normal 5Gi* +execute 'GitGutterStageHunk' +call DumpSigns('hunkStageSigns') +call DumpGitDiff('hunkStageGitDiff')