]> www.average.org Git - pdns-pipe-nmc.git/blobdiff - test.hs
replaceable backend and test prototype
[pdns-pipe-nmc.git] / test.hs
diff --git a/test.hs b/test.hs
new file mode 100644 (file)
index 0000000..7c3be16
--- /dev/null
+++ b/test.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module Main where
+
+import Prelude hiding (readFile)
+import Data.ByteString.Lazy (ByteString)
+import Data.ByteString.Lazy.Char8 (unpack, readFile)
+import System.IO.Error
+import Control.Exception
+
+import NmcDom
+
+queryOp :: ByteString -> IO (Either String ByteString)
+queryOp key = catch (readFile ("data/" ++ (unpack key)) >>= return . Right)
+                    (\e -> return (Left (show (e :: IOException))))
+
+main = do
+        d <- queryDom queryOp "root"
+        putStrLn $ show d
+