Skip to content
Snippets Groups Projects
Commit f2617811 authored by Jerome Reybert's avatar Jerome Reybert
Browse files

test/: fix test for subdir

parent c8bc49e7
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,12 @@ Include: setup.inc ...@@ -2,10 +2,12 @@ Include: setup.inc
# add test # add test
Execute (Add file): Execute (Add file):
call Cd_test_sub()
Magit Magit
/untracked: bootstrap /untracked: bootstrap
call Move_relative(+1) call Move_relative(+1)
call magit#stage_file() call magit#stage_file()
call Cd_test()
call Git_diff('staged', 'bootstrap', '/tmp/addFile_bootstrap.test') call Git_diff('staged', 'bootstrap', '/tmp/addFile_bootstrap.test')
call Expect_diff(g:test_dir . 'addFile_bootstrap.expect', '/tmp/addFile_bootstrap.test') call Expect_diff(g:test_dir . 'addFile_bootstrap.expect', '/tmp/addFile_bootstrap.test')
......
Execute (cleanup): Execute (cleanup):
call system("git reset --hard " . $TEST_HEAD_SHA1) call system("git reset --hard " . $TEST_HEAD_SHA1)
cd $VIMAGIT_PATH call Cd_vimagit()
...@@ -11,10 +11,11 @@ endfunction ...@@ -11,10 +11,11 @@ endfunction
function! Git_diff(state, file, output) function! Git_diff(state, file, output)
let staged_flag = ( a:state == 'staged' ) ? ' --staged ' : '' let staged_flag = ( a:state == 'staged' ) ? ' --staged ' : ''
let diff=system("git diff --no-color --no-ext-diff --src-prefix='' --dst-prefix='' " . let diff_cmd="git diff --no-color --no-ext-diff --src-prefix='' --dst-prefix='' " .
\ staged_flag . a:file . \ staged_flag . " -- " . a:file .
\ " | \\grep -v \"^index [[:xdigit:]]\\{7\\}\\.\\.[[:xdigit:]]\\{7\\}\" > " . \ " | \\grep -v \"^index [[:xdigit:]]\\{7\\}\\.\\.[[:xdigit:]]\\{7\\}\" > " .
\ a:output) \ a:output)
let diff=system(diff_cmd)
if ( v:shell_error != 0 ) if ( v:shell_error != 0 )
echoerr "git diff: " . diff echoerr "git diff: " . diff
endif endif
...@@ -24,7 +25,19 @@ endfunction ...@@ -24,7 +25,19 @@ endfunction
function! Expect_diff(gold_file, test_file) function! Expect_diff(gold_file, test_file)
let diff=system("diff " . a:gold_file . " " . a:test_file) let diff=system("diff " . a:gold_file . " " . a:test_file)
if ( v:shell_error != 0 ) if ( v:shell_error != 0 )
echoerr "git diff: " . diff echoerr "diff: " . diff
endif endif
return v:shell_error return v:shell_error
endfunction endfunction
function! Cd_vimagit()
cd $VIMAGIT_PATH
endfunction
function! Cd_test()
cd $TEST_PATH
endfunction
function! Cd_test_sub()
cd $TEST_SUB_PATH
endfunction
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment