From 91fa188484a795ded0e10b561cc205d6b9826723 Mon Sep 17 00:00:00 2001 From: Philipp Balzarek Date: Sat, 13 Oct 2012 14:46:44 +0200 Subject: [PATCH] add data forms test cases --- tests/DataForms.hs | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 tests/DataForms.hs diff --git a/tests/DataForms.hs b/tests/DataForms.hs new file mode 100644 index 0000000..b982bf8 --- /dev/null +++ b/tests/DataForms.hs @@ -0,0 +1,128 @@ +{-# LANGUAGE OverloadedStrings #-} + +module Tests.DataForms where + +import Network.Xmpp.Xep.DataForms + +import qualified Data.Text.Lazy as TL +import qualified Text.XML.Stream.Elements as Elements +import qualified Data.XML.Types as XML +import Data.XML.Pickle + +test1 = TL.concat $ + ["" + ,"Bot Configuration" + ,"Fill out this form to configure your new bot!" + ,"" + ,"jabber:bot" + ,"" + ,"Section 1: Bot Info" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"Section 2: Features" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"news" + ,"search" + ,"" + ,"Section 3: Subscriber List" + ,"" + ,"20" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"" + ,"Section 4: Invitations" + ,"" + ,"Tell all your friends about your new bot!" + ,"" + ,""] + +test2 = TL.concat [ + " " + ," " + ," jabber:bot" + ," " + ," " + ," The Jabber Google Bot" + ," " + ," " + ," This bot enables you to send requests to" + ," Google and receive the search results right" + ," in your Jabber client. It' really cool!" + ," It even supports Google News!" + ," " + ," " + ," 0" + ," " + ," " + ," v3r0na" + ," " + ," " + ," news" + ," search" + ," " + ," " + ," 50" + ," " + ," " + ," juliet@capulet.com" + ," benvolio@montague.net" + ," " + ," "] + + +test3 = TL.concat [ + " " + , " " + , " jabber:bot" + , " " + , " " + , " The Jabber Google Bot" + , " " + , " " + , " 0" + , " " + , " " + , " v3r0na" + , " " + , " " + , " news" + , " search" + , " " + , " " + , " 50" + , " " + , " " + , " juliet@capulet.com" + , " benvolio@montague.net" + , " " + , " "] + +parseForm = unpickleTree (xpRoot xpForm) . XML.NodeElement . Elements.parseElement \ No newline at end of file