test precommit; 74%
This commit is contained in:
parent
868486c6b6
commit
b13039d62e
1 changed files with 23 additions and 13 deletions
36
test.hs
36
test.hs
|
@ -231,19 +231,29 @@ test_lock = "git-annex unlock/lock" ~: intmpclonerepo $ do
|
||||||
(not r) @? "drop wrongly succeeded with no known copy of modified file"
|
(not r) @? "drop wrongly succeeded with no known copy of modified file"
|
||||||
|
|
||||||
test_edit :: Test
|
test_edit :: Test
|
||||||
test_edit = "git-annex edit/commit" ~: intmpclonerepo $ do
|
test_edit = "git-annex edit/commit" ~: TestList [t False, t True]
|
||||||
git_annex "get" ["-q", annexedfile] @? "get of file failed"
|
where t precommit = TestCase $ intmpclonerepo $ do
|
||||||
annexed_present annexedfile
|
git_annex "get" ["-q", annexedfile] @? "get of file failed"
|
||||||
git_annex "edit" ["-q", annexedfile] @? "edit failed"
|
annexed_present annexedfile
|
||||||
unannexed annexedfile
|
git_annex "edit" ["-q", annexedfile] @? "edit failed"
|
||||||
changecontent annexedfile
|
unannexed annexedfile
|
||||||
Utility.boolSystem "git" ["commit", "-q", "-a", "-m", "content changed"]
|
changecontent annexedfile
|
||||||
@? "git commit of edited file failed"
|
if precommit
|
||||||
runchecks [checklink, checkunwritable] annexedfile
|
then do
|
||||||
c <- readFile annexedfile
|
-- pre-commit depends on the file being
|
||||||
assertEqual ("content of modified file") c (changedcontent annexedfile)
|
-- staged, normally git commit does this
|
||||||
r <- git_annex "drop" ["-q", annexedfile]
|
Utility.boolSystem "git" ["add", annexedfile]
|
||||||
(not r) @? "drop wrongly succeeded with no known copy of modified file"
|
@? "git add of edited file failed"
|
||||||
|
git_annex "pre-commit" ["-q"]
|
||||||
|
@? "pre-commit failed"
|
||||||
|
else do
|
||||||
|
Utility.boolSystem "git" ["commit", "-q", "-a", "-m", "content changed"]
|
||||||
|
@? "git commit of edited file failed"
|
||||||
|
runchecks [checklink, checkunwritable] annexedfile
|
||||||
|
c <- readFile annexedfile
|
||||||
|
assertEqual ("content of modified file") c (changedcontent annexedfile)
|
||||||
|
r <- git_annex "drop" ["-q", annexedfile]
|
||||||
|
(not r) @? "drop wrongly succeeded with no known copy of modified file"
|
||||||
|
|
||||||
test_fix :: Test
|
test_fix :: Test
|
||||||
test_fix = "git-annex fix" ~: intmpclonerepo $ do
|
test_fix = "git-annex fix" ~: intmpclonerepo $ do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue