diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-08 00:38:27 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-08 00:39:19 -0400 |
commit | 8ce422d8ab390e105d70f049c30d81c14d3b64b4 (patch) | |
tree | a747cefa503c067f49988ef6412eb58f459bd7b6 /Test.hs | |
parent | 37a34b3dbcfb38f815edc141a57721d9f94440b4 (diff) |
better method for running tasty's optparse as a subcommand
Diffstat (limited to 'Test.hs')
-rw-r--r-- | Test.hs | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -15,12 +15,12 @@ import Test.Tasty.HUnit import Test.Tasty.QuickCheck import Test.Tasty.Ingredients.Rerun -import Options.Applicative hiding (command) import qualified Data.Map as M import qualified Text.JSON import Common +import qualified Utility.SubTasty import qualified Utility.SafeCommand import qualified Annex import qualified Annex.UUID @@ -83,11 +83,7 @@ import qualified Utility.Gpg main :: [String] -> IO () main ps = do - -- Can't use tasty's defaultMain because one of the command line - -- parameters is "test". - let pinfo = info (helper <*> suiteOptionParser ingredients tests) - ( fullDesc <> header "Builtin test suite" ) - opts <- parseOpts (prefs idm) pinfo ps + opts <- Utility.SubTasty.parseOpts "test" ingredients tests ("test":ps) case tryIngredients ingredients opts tests of Nothing -> error "No tests found!?" Just act -> ifM act @@ -97,13 +93,6 @@ main ps = do putStrLn " with utilities, such as git, installed on this system.)" exitFailure ) - where - parseOpts pprefs pinfo args = - case execParserPure pprefs pinfo args of - (Options.Applicative.Failure failure) -> do - let (msg, _exit) = renderFailure failure "git-annex test" - error msg - v -> handleParseResult v ingredients :: [Ingredient] ingredients = |