diff options
author | Joey Hess <joey@kitenet.net> | 2011-01-11 21:11:32 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-01-11 21:11:32 -0400 |
commit | b557a2ccf4cd634a2c276b9ae03b881814de58be (patch) | |
tree | 5a1eed66d0183cc81e65358e9a6d0d14c5a33582 /test.hs | |
parent | b13039d62eb3a99606562f2edca7405b96776787 (diff) |
test migrate; 75%
Diffstat (limited to 'test.hs')
-rw-r--r-- | test.hs | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -73,6 +73,7 @@ toplevels = TestLabel "toplevel" $ TestList , test_fix , test_trust , test_fsck + , test_migrate ] test_init :: Test @@ -313,6 +314,35 @@ test_fsck = "git-annex fsck" ~: intmpclonerepo $ do not r @? "fsck failed to fail with corrupted file content" git_annex "fsck" ["-q"] @? "fsck unexpectedly failed again; previous one did not fix problem" +test_migrate :: Test +test_migrate = "git-annex migrate" ~: TestList [t False, t True] + where t usegitattributes = TestCase $ intmpclonerepo $ do + annexed_notpresent annexedfile + annexed_notpresent sha1annexedfile + git_annex "migrate" ["-q", annexedfile] @? "migrate of not present failed" + git_annex "migrate" ["-q", sha1annexedfile] @? "migrate of not present failed" + git_annex "get" ["-q", annexedfile] @? "get of file failed" + git_annex "get" ["-q", sha1annexedfile] @? "get of file failed" + annexed_present annexedfile + annexed_present sha1annexedfile + if usegitattributes + then do + writeFile ".gitattributes" "* annex.backend=SHA1" + git_annex "migrate" [sha1annexedfile] @? "migrate to same backend failed" + git_annex "migrate" [annexedfile] @? "migrate to different backend failed" + else do + git_annex "migrate" [sha1annexedfile, "--backend=SHA1"] @? "migrate to same backend failed" + git_annex "migrate" [annexedfile, "--backend=SHA1"] @? "migrate to different backend failed" + annexed_present annexedfile + annexed_present sha1annexedfile + backend annexedfile Backend.SHA1.backend + backend sha1annexedfile Backend.SHA1.backend + where + backend file expected = do + r <- annexeval $ Backend.lookupFile file + let b = snd $ fromJust r + assertEqual ("backend for " ++ file) expected b + -- This is equivilant to running git-annex, but it's all run in-process -- so test coverage collection works. git_annex :: String -> [String] -> IO Bool |