cleanup
This commit is contained in:
parent
ecca55ae85
commit
c3e19d65e4
1 changed files with 15 additions and 20 deletions
15
Test.hs
15
Test.hs
|
@ -213,7 +213,7 @@ test_reinject env = "git-annex reinject/fromkey" ~: TestCase $ intmpclonerepo en
|
||||||
Types.KeySource.KeySource { Types.KeySource.keyFilename = tmp, Types.KeySource.contentLocation = tmp, Types.KeySource.inodeCache = Nothing }
|
Types.KeySource.KeySource { Types.KeySource.keyFilename = tmp, Types.KeySource.contentLocation = tmp, Types.KeySource.inodeCache = Nothing }
|
||||||
let key = Types.Key.key2file $ fromJust r
|
let key = Types.Key.key2file $ fromJust r
|
||||||
git_annex env "reinject" [tmp, sha1annexedfile] @? "reinject failed"
|
git_annex env "reinject" [tmp, sha1annexedfile] @? "reinject failed"
|
||||||
git_annex env "fromkey" [key, sha1annexedfiledup] @? "fromkey failed"
|
git_annex env "fromkey" [key, sha1annexedfiledup] @? "fromkey failed for dup"
|
||||||
annexed_present sha1annexedfiledup
|
annexed_present sha1annexedfiledup
|
||||||
where
|
where
|
||||||
tmp = "tmpfile"
|
tmp = "tmpfile"
|
||||||
|
@ -866,12 +866,10 @@ cleanup dir = do
|
||||||
checklink :: FilePath -> Assertion
|
checklink :: FilePath -> Assertion
|
||||||
checklink f = do
|
checklink f = do
|
||||||
s <- getSymbolicLinkStatus f
|
s <- getSymbolicLinkStatus f
|
||||||
ifM (annexeval Config.isDirect)
|
|
||||||
-- in direct mode, it may be a symlink, or not, depending
|
-- in direct mode, it may be a symlink, or not, depending
|
||||||
-- on whether the content is present.
|
-- on whether the content is present.
|
||||||
( return ()
|
unlessM (annexeval Config.isDirect) $
|
||||||
, isSymbolicLink s @? f ++ " is not a symlink"
|
isSymbolicLink s @? f ++ " is not a symlink"
|
||||||
)
|
|
||||||
|
|
||||||
checkregularfile :: FilePath -> Assertion
|
checkregularfile :: FilePath -> Assertion
|
||||||
checkregularfile f = do
|
checkregularfile f = do
|
||||||
|
@ -882,12 +880,10 @@ checkregularfile f = do
|
||||||
checkcontent :: FilePath -> Assertion
|
checkcontent :: FilePath -> Assertion
|
||||||
checkcontent f = do
|
checkcontent f = do
|
||||||
c <- readFile f
|
c <- readFile f
|
||||||
assertEqual ("checkcontent " ++ f) c (content f)
|
assertEqual ("checkcontent " ++ f) (content f) c
|
||||||
|
|
||||||
checkunwritable :: FilePath -> Assertion
|
checkunwritable :: FilePath -> Assertion
|
||||||
checkunwritable f = ifM (annexeval Config.isDirect)
|
checkunwritable f = unlessM (annexeval Config.isDirect) $ do
|
||||||
( return ()
|
|
||||||
, do
|
|
||||||
-- Look at permissions bits rather than trying to write or
|
-- Look at permissions bits rather than trying to write or
|
||||||
-- using fileAccess because if run as root, any file can be
|
-- using fileAccess because if run as root, any file can be
|
||||||
-- modified despite permissions.
|
-- modified despite permissions.
|
||||||
|
@ -896,7 +892,6 @@ checkunwritable f = ifM (annexeval Config.isDirect)
|
||||||
if (mode == mode `unionFileModes` ownerWriteMode)
|
if (mode == mode `unionFileModes` ownerWriteMode)
|
||||||
then assertFailure $ "able to modify annexed file's " ++ f ++ " content"
|
then assertFailure $ "able to modify annexed file's " ++ f ++ " content"
|
||||||
else return ()
|
else return ()
|
||||||
)
|
|
||||||
|
|
||||||
checkwritable :: FilePath -> Assertion
|
checkwritable :: FilePath -> Assertion
|
||||||
checkwritable f = do
|
checkwritable f = do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue