From 61517df00b34bb1b985705092de5e81d13fb59c9 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sat, 17 Mar 2012 22:39:10 +0100 Subject: tests && executables --- Test.hs | 52 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 9 deletions(-) (limited to 'Test.hs') diff --git a/Test.hs b/Test.hs index c658e08..c5393bc 100644 --- a/Test.hs +++ b/Test.hs @@ -1,19 +1,53 @@ -module Main (main) where +module Main(main) where + +import Network.EBus.Layer2 as L2 + +-- main = do +-- -- * Select binary mode (True) or text mode (False) on a open handle. (See also openBinaryFile.) +-- hSetBinaryMode stdin True +-- -- * run +-- -- Run an iteratee until it finishes, and return either the final value (if it succeeded) or the error (if it failed). +-- -- * run_ +-- -- Like run, except errors are converted to exceptions and thrown. Primarily useful for small scripts or other simple cases. + +-- maybePacket <- run( enumSource $$ runParser ) +-- case maybePacket of +-- Right result -> print result +-- Left error -> print error + +-- maybePacket <- run( enumSource $$ runParser ) +-- case maybePacket of +-- Right result -> print result +-- Left error -> print error + + +-- enumSource :: Enumerator ByteString IO a +-- enumSource = enumHandle 1 stdin + +-- runParser :: Iteratee ByteString IO EbusPacket +-- runParser = do +-- p <- iterParser parser +-- return p import Test.Framework -import qualified Test.Framework as TF import Test.Framework.Providers.HUnit -import Test.HUnit -import Control.Concurrent (forkOS) -import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, putMVar) -import Control.Exception (finally) -import Control.Monad.Trans (liftIO) +main = + defaultMain [ + testGroup "SomeModule" [ testCase "foo" foooo] + ] -import qualified Data.Binary as B +foooo :: IO() +foooo = do + print "OK" -import Network.EBus.Layer2 as L2 +-- import Control.Concurrent (forkOS) +-- import Control.Concurrent.MVar (MVar, newEmptyMVar, readMVar, putMVar) +-- import Control.Exception (finally) +-- import Control.Monad.Trans (liftIO) + +-- import qualified Data.Binary as B -- import qualified System.ZMQ as ZMQ -- cgit v1.2.1