2013-02-27 19:35:07 +00:00
|
|
|
{- git-annex command
|
|
|
|
-
|
2015-07-13 17:19:20 +00:00
|
|
|
- Copyright 2013-2015 Joey Hess <id@joeyh.name>
|
2013-02-27 19:35:07 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Command.Test where
|
|
|
|
|
|
|
|
import Command
|
2015-07-13 17:19:20 +00:00
|
|
|
import Types.Test
|
2013-02-27 19:35:07 +00:00
|
|
|
|
2015-07-13 17:19:20 +00:00
|
|
|
cmd :: Parser TestOptions -> Maybe TestRunner -> Command
|
|
|
|
cmd optparser runner = noRepo (startIO runner <$$> const optparser) $
|
|
|
|
dontCheck repoExists $
|
|
|
|
command "test" SectionTesting
|
|
|
|
"run built-in test suite"
|
|
|
|
paramNothing (seek runner <$$> const optparser)
|
2013-02-27 19:35:07 +00:00
|
|
|
|
2015-07-13 17:19:20 +00:00
|
|
|
seek :: Maybe TestRunner -> TestOptions -> CommandSeek
|
|
|
|
seek runner o = commandAction $ start runner o
|
2013-02-27 19:35:07 +00:00
|
|
|
|
2015-07-13 17:19:20 +00:00
|
|
|
start :: Maybe TestRunner -> TestOptions -> CommandStart
|
|
|
|
start runner o = do
|
|
|
|
liftIO $ startIO runner o
|
2014-01-15 16:49:56 +00:00
|
|
|
stop
|
2014-01-17 18:48:56 +00:00
|
|
|
|
2015-07-13 17:19:20 +00:00
|
|
|
startIO :: Maybe TestRunner -> TestOptions -> IO ()
|
|
|
|
startIO Nothing _ = warningIO "git-annex was built without its test suite; not testing"
|
|
|
|
startIO (Just runner) o = runner o
|