summaryrefslogtreecommitdiff
path: root/Command/Test.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-27 15:35:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-27 15:38:21 -0400
commit38f9605143c5fc80f0948ec4e579a6b4598e70dd (patch)
tree1f93e7d42edcafc08e8fbc928fe7f6bcf1deb092 /Command/Test.hs
parent52573c7b8cd253c43e92decce6cded80d8eca8f3 (diff)
embed test suite into git annex; available by running: git annex test
I have seen some other programs do this, and think it's pretty cool. Means you can test wherever it's deployed, as well as at build time. My other reason for doing it is less happy. Cabal's handling of test suites sucks, requiring duplicated info, and even when that's done, it fails to preprocess hsc files here. Building it in avoids that and avoids having to explicitly tell cabal to enable test suites, which would then make it link the test executable every time, which is unnecessarily slow. This also has the benefit that now "make fast test" does a max speed build and tests it.
Diffstat (limited to 'Command/Test.hs')
-rw-r--r--Command/Test.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Command/Test.hs b/Command/Test.hs
new file mode 100644
index 000000000..839829e0a
--- /dev/null
+++ b/Command/Test.hs
@@ -0,0 +1,33 @@
+{- git-annex command
+ -
+ - Copyright 2013 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Command.Test where
+
+import Common.Annex
+import Command
+import qualified Command.Init
+import qualified Command.Add
+import qualified Command.Drop
+import qualified Command.Get
+import qualified Command.Move
+import qualified Command.Copy
+import qualified Command.Sync
+import qualified Command.Whereis
+import qualified Command.Fsck
+import qualified Test
+
+def :: [Command]
+def = [noCommit $ noRepo showHelp $ dontCheck repoExists $
+ command "test" paramNothing seek "run built-in test suite"]
+
+seek :: [CommandSeek]
+seek = [withWords start]
+
+start :: [String] -> CommandStart
+start _ = do
+ liftIO $ Test.main
+ stop