X-Git-Url: http://www.average.org/gitweb/?p=pdns-pipe-nmc.git;a=blobdiff_plain;f=test.hs;h=3a9f8b4e0c4c2c92d4858fbdafbaa9dbf547ff26;hp=7c3be16f36d55dc85299aba23a34d422b07a389f;hb=addaa72e7493ffef098e80e3a801d4101a0bc628;hpb=531dbfc03d955178e596a7cd9b87fca8bc23918e diff --git a/test.hs b/test.hs index 7c3be16..3a9f8b4 100644 --- a/test.hs +++ b/test.hs @@ -3,18 +3,21 @@ module Main where import Prelude hiding (readFile) +import System.Environment import Data.ByteString.Lazy (ByteString) -import Data.ByteString.Lazy.Char8 (unpack, readFile) +import Data.ByteString.Lazy.Char8 (readFile) import System.IO.Error import Control.Exception +import Text.Show.Pretty import NmcDom +import NmcTransform -queryOp :: ByteString -> IO (Either String ByteString) -queryOp key = catch (readFile ("data/" ++ (unpack key)) >>= return . Right) +queryOp :: String -> IO (Either String ByteString) +queryOp key = catch (readFile key >>= return . Right) (\e -> return (Left (show (e :: IOException)))) main = do - d <- queryDom queryOp "root" - putStrLn $ show d + (d:_) <- getArgs + descendNmcDom queryOp [] (seedNmcDom d) >>= putStrLn . ppShow