summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-05-15 19:58:40 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-05-15 19:58:40 -0400
commit0511c89926879fe0d89082ade9ae3e71bd79dc7b (patch)
treec0c882b7d8011041b32d7feb9541cf2c75e3edc7
parentfe131bce0c365c5b95a9e464cf4252c862ff7118 (diff)
cleanup
-rw-r--r--Test.hs35
1 files changed, 15 insertions, 20 deletions
diff --git a/Test.hs b/Test.hs
index a4ae46c17..ad7c57b79 100644
--- a/Test.hs
+++ b/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 }
let key = Types.Key.key2file $ fromJust r
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
where
tmp = "tmpfile"
@@ -866,12 +866,10 @@ cleanup dir = do
checklink :: FilePath -> Assertion
checklink f = do
s <- getSymbolicLinkStatus f
- ifM (annexeval Config.isDirect)
- -- in direct mode, it may be a symlink, or not, depending
- -- on whether the content is present.
- ( return ()
- , isSymbolicLink s @? f ++ " is not a symlink"
- )
+ -- in direct mode, it may be a symlink, or not, depending
+ -- on whether the content is present.
+ unlessM (annexeval Config.isDirect) $
+ isSymbolicLink s @? f ++ " is not a symlink"
checkregularfile :: FilePath -> Assertion
checkregularfile f = do
@@ -882,21 +880,18 @@ checkregularfile f = do
checkcontent :: FilePath -> Assertion
checkcontent f = do
c <- readFile f
- assertEqual ("checkcontent " ++ f) c (content f)
+ assertEqual ("checkcontent " ++ f) (content f) c
checkunwritable :: FilePath -> Assertion
-checkunwritable f = ifM (annexeval Config.isDirect)
- ( return ()
- , do
- -- Look at permissions bits rather than trying to write or
- -- using fileAccess because if run as root, any file can be
- -- modified despite permissions.
- s <- getFileStatus f
- let mode = fileMode s
- if (mode == mode `unionFileModes` ownerWriteMode)
- then assertFailure $ "able to modify annexed file's " ++ f ++ " content"
- else return ()
- )
+checkunwritable f = unlessM (annexeval Config.isDirect) $ do
+ -- Look at permissions bits rather than trying to write or
+ -- using fileAccess because if run as root, any file can be
+ -- modified despite permissions.
+ s <- getFileStatus f
+ let mode = fileMode s
+ if (mode == mode `unionFileModes` ownerWriteMode)
+ then assertFailure $ "able to modify annexed file's " ++ f ++ " content"
+ else return ()
checkwritable :: FilePath -> Assertion
checkwritable f = do