summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Network/EBus/Layer2.hs28
-rw-r--r--Test.hs52
-rw-r--r--ebus.cabal30
l---------exec/.#ebus-dump-layer2.hs1
-rw-r--r--exec/ebus-dump-layer2.hs4
6 files changed, 64 insertions, 54 deletions
diff --git a/.gitignore b/.gitignore
index b25c15b..0f3c320 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
*~
+*.hi
+*.o
+dist
diff --git a/Network/EBus/Layer2.hs b/Network/EBus/Layer2.hs
index 496e9b1..c4f1d47 100644
--- a/Network/EBus/Layer2.hs
+++ b/Network/EBus/Layer2.hs
@@ -1,3 +1,5 @@
+module Network.EBus.Layer2 where
+
import Control.Applicative
import Data.Attoparsec
import Data.Attoparsec.Enumerator (iterParser)
@@ -134,29 +136,3 @@ parser = do{
<|> fail "Failed to parse packet"
}
-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
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
diff --git a/ebus.cabal b/ebus.cabal
index 0a160f7..4b05a48 100644
--- a/ebus.cabal
+++ b/ebus.cabal
@@ -10,7 +10,7 @@ Category: Network
Maintainer: Yves Fischer <yvesf-haskell@xapek.org>
Build-Type: Simple
Homepage: http://www.example.com
-Cabal-Version: >=1.2
+Cabal-Version: >=1.9.2
-- Extra-source-files: examples/ExampleConsumer.hs,
@@ -22,26 +22,18 @@ Cabal-Version: >=1.2
-- branch: master
Library
- Build-Depends: base >=4 && < 5, attoparsec >= 0.10.1.1, bytestring
- GHC-Options: -Wall
+ Build-Depends: base >=4 && < 5, attoparsec >= 0.10.1.1, attoparsec-enumerator >= 0.3, bytestring, enumerator >= 0.4.18
+-- GHC-Options: -Wall
Exposed-modules: Network.EBus.Layer2
-- Other-modules: Network.AMQP.Generated, Network.AMQP.Helpers, Network.AMQP.Protocol
--- Executable test-binary-protocol-zmq
--- Main-Is: Test.hs
+Test-Suite test-network-ebus
+ type: exitcode-stdio-1.0
+ main-is: Test.hs
+ build-depends: base, test-framework >= 0.6, test-framework-hunit >= 0.2.7, ebus,
+ bytestring, attoparsec >= 0.10.1.1, attoparsec-enumerator >= 0.3, enumerator >= 0.4.18
--- if !flag(tests)
--- Buildable: False
--- else
--- Build-Depends:
--- base >= 4 && < 5,
--- test-framework,
--- test-framework-hunit,
--- HUnit
--- Other-Modules:
--- Control.Monad.BinaryProtocol.ZMQ
-
--- GHC-Options: -Wall -fno-warn-unused-binds -threaded
--- if flag(optimize)
--- GHC-Options: -funbox-strict-fields -O2 -fspec-constr -fdicts-cheap \ No newline at end of file
+Executable ebus-dump-layer2
+ Main-Is: exec/ebus-dump-layer2.hs
+ Build-Depends: base >=4 && < 5, ebus
diff --git a/exec/.#ebus-dump-layer2.hs b/exec/.#ebus-dump-layer2.hs
new file mode 120000
index 0000000..1a565a9
--- /dev/null
+++ b/exec/.#ebus-dump-layer2.hs
@@ -0,0 +1 @@
+yvesf@x200s.23051:1331883860 \ No newline at end of file
diff --git a/exec/ebus-dump-layer2.hs b/exec/ebus-dump-layer2.hs
new file mode 100644
index 0000000..84d72e2
--- /dev/null
+++ b/exec/ebus-dump-layer2.hs
@@ -0,0 +1,4 @@
+module Main(main) where
+
+main = do
+ print "Hello ebus-dump-layer"