mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Fix preview and undo hunk for dos line endings
This commit is contained in:
10
test/fixture_dos.txt
Normal file
10
test/fixture_dos.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
a
|
||||
b
|
||||
c
|
||||
d
|
||||
e
|
||||
f
|
||||
g
|
||||
h
|
||||
i
|
||||
j
|
||||
@@ -55,6 +55,7 @@ function SetUp()
|
||||
call system("git init ".s:test_repo.
|
||||
\ " && cd ".s:test_repo.
|
||||
\ " && cp ../fixture.txt .".
|
||||
\ " && cp ../fixture_dos.txt .".
|
||||
\ " && git add . && git commit -m 'initial'".
|
||||
\ " && git config diff.mnemonicPrefix false")
|
||||
execute ':cd' s:test_repo
|
||||
@@ -349,6 +350,34 @@ function Test_hunk_outside_noop()
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_preview_foo()
|
||||
normal 5Gi*
|
||||
GitGutterPreviewHunk
|
||||
|
||||
wincmd P
|
||||
call assert_equal(2, line('$'))
|
||||
call assert_equal('-e', getline(1))
|
||||
call assert_equal('+*e', getline(2))
|
||||
wincmd p
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_preview_dos_foo()
|
||||
edit! fixture_dos.txt
|
||||
|
||||
normal 5Gi*
|
||||
GitGutterPreviewHunk
|
||||
|
||||
wincmd P
|
||||
call assert_equal(2, line('$'))
|
||||
call assert_equal('-e', getline(1))
|
||||
call assert_equal('+*e', getline(2))
|
||||
wincmd p
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
|
||||
function Test_hunk_stage()
|
||||
let _shell = &shell
|
||||
set shell=foo
|
||||
@@ -657,6 +686,19 @@ function Test_hunk_undo()
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_hunk_undo_dos()
|
||||
edit! fixture_dos.txt
|
||||
|
||||
normal 5Gi*
|
||||
GitGutterUndoHunk
|
||||
|
||||
call s:assert_signs([], 'fixture_dos.txt')
|
||||
call assert_equal([], s:git_diff())
|
||||
call assert_equal([], s:git_diff_staged())
|
||||
call assert_equal('e', getline(5))
|
||||
endfunction
|
||||
|
||||
|
||||
function Test_undo_nearby_hunk()
|
||||
execute "normal! 2Gox\<CR>y\<CR>z"
|
||||
normal 2jdd
|
||||
|
||||
Reference in New Issue
Block a user