diff --git a/Command/TestRemote.hs b/Command/TestRemote.hs index 674415c275..21b38dc248 100644 --- a/Command/TestRemote.hs +++ b/Command/TestRemote.hs @@ -5,7 +5,7 @@ - Licensed under the GNU AGPL version 3 or higher. -} -{-# LANGUAGE RankNTypes #-} +{-# LANGUAGE RankNTypes, DeriveFunctor #-} module Command.TestRemote where @@ -194,7 +194,7 @@ adjustRemoteConfig getcache r adjustconfig = do data Described t = Described { getDesc :: String , getVal :: t - } + } deriving Functor type RunAnnex = forall a. Annex a -> IO a diff --git a/Test.hs b/Test.hs index 5870d4c6c5..fa04cc8eb3 100644 --- a/Test.hs +++ b/Test.hs @@ -1,6 +1,6 @@ {- git-annex test suite - - - Copyright 2010-2020 Joey Hess + - Copyright 2010-2021 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -229,12 +229,12 @@ testRemotes = testGroup "Remote Tests" ] testGitRemote :: TestTree -testGitRemote = testRemote "git" $ \remotename -> do +testGitRemote = testRemote False "git" $ \remotename -> do git "clone" [".", "remotedir"] "git clone" git "remote" ["add", remotename, "remotedir"] "git remote add" testDirectoryRemote :: TestTree -testDirectoryRemote = testRemote "directory" $ \remotename -> do +testDirectoryRemote = testRemote True "directory" $ \remotename -> do createDirectory "remotedir" git_annex "initremote" [ remotename @@ -244,8 +244,8 @@ testDirectoryRemote = testRemote "directory" $ \remotename -> do , "encryption=none" ] "init" -testRemote :: String -> (String -> IO ()) -> TestTree -testRemote remotetype setupremote = +testRemote :: Bool -> String -> (String -> IO ()) -> TestTree +testRemote testvariants remotetype setupremote = withResource newEmptyTMVarIO (const noop) $ \getv -> testGroup ("testremote type " ++ remotetype) $ concat [ [testCase "init" (prep getv)] @@ -275,7 +275,9 @@ testRemote remotetype setupremote = go getv = Command.TestRemote.mkTestTrees runannex mkrs mkunavailr mkexportr mkks where runannex = inmainrepo . annexeval - mkrs = Command.TestRemote.remoteVariants cache mkr basesz False + mkrs = if testvariants + then Command.TestRemote.remoteVariants cache mkr basesz False + else [fmap (fmap Just) mkr] mkr = descas (remotetype ++ " remote") (fst <$> v) mkunavailr = fst . snd <$> v mkexportr = fst . snd . snd <$> v