This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "heist".

The branch, master has been updated
       via  c6123314cc4f46644fa0a95a8a5a71119bd10c70 (commit)
       via  3a96b18390e12b58f8982aa0277481e134cf96a8 (commit)
       via  7a58a9848fd27bc2b8c5d2c4fecefaa556b40e4d (commit)
      from  c691b091e2376f0436d80de5e0751181b56e219c (commit)


Summary of changes:
 test/suite/Text/Templating/Heist/Tests.hs |   33 ++++++++++++++++++++++-------
 test/templates/bind-attrs.tpl             |    2 +
 2 files changed, 27 insertions(+), 8 deletions(-)
 create mode 100644 test/templates/bind-attrs.tpl

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c6123314cc4f46644fa0a95a8a5a71119bd10c70
Author: Gregory Collins <[email protected]>
Date:   Thu Oct 21 11:19:45 2010 +0200

    Fix Will's test

diff --git a/test/suite/Text/Templating/Heist/Tests.hs 
b/test/suite/Text/Templating/Heist/Tests.hs
index f7caa23..21f1599 100644
--- a/test/suite/Text/Templating/Heist/Tests.hs
+++ b/test/suite/Text/Templating/Heist/Tests.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE OverloadedStrings, TypeSynonymInstances, 
GeneralizedNewtypeDeriving #-}
+
 module Text.Templating.Heist.Tests
   ( tests
   , quickRender
@@ -41,7 +42,7 @@ tests = [ testProperty "simpleBindTest" $ monadicIO $ forAllM 
arbitrary prop_sim
         , testCase "renderNoNameTest" renderNoNameTest
         , testCase "doctypeTest" doctypeTest
         , testCase "attributeSubstitution" attrSubstTest
-        , testCase "bindAttribute" attrSubstTest
+        , testCase "bindAttribute" bindAttrTest
         , testCase "applyTest" applyTest
         ]
 
@@ -135,14 +136,14 @@ bindAttrTest :: H.Assertion
 bindAttrTest = do
     ets <- loadT "templates"
     let ts = either (error "Error loading templates") id ets
-    check ts "pre__post"
+    check ts "<div id=\"zzzzz\""
   where
     check ts str = do
         res <- renderTemplate ts "bind-attrs"
         H.assertBool ("attr subst " ++ (show str)) $
             not $ B.null $ snd $ B.breakSubstring str $ fromJust res
         H.assertBool ("attr subst bar") $
-            not $ B.null $ snd $ B.breakSubstring "$(bar)" $ fromJust res
+            B.null $ snd $ B.breakSubstring "$(bar)" $ fromJust res
 
 
 -- dotdotTest :: H.Assertion
@@ -161,10 +162,10 @@ newtype Name = Name { unName :: B.ByteString } deriving 
(Show)
 
 instance Arbitrary Name where
   arbitrary = do
-    first <- elements identStartChar
-    n <- choose (4,10)
-    rest <- vectorOf n $ elements identChar
-    return $ Name $ B.pack $ first : rest
+    x     <- elements identStartChar
+    n     <- choose (4,10)
+    rest  <- vectorOf n $ elements identChar
+    return $ Name $ B.pack (x:rest)
 
 instance Arbitrary Node where
   arbitrary = limitedDepth 3
diff --git a/test/templates/bind-attrs.tpl b/test/templates/bind-attrs.tpl
index c5cd7ea..d11576b 100644
--- a/test/templates/bind-attrs.tpl
+++ b/test/templates/bind-attrs.tpl
@@ -1,2 +1,2 @@
-<bind tag="bar">meaning_of_everything</bind>
+<bind tag="bar">zzzzz</bind>
 <div id="$(bar)"> </div>
commit 3a96b18390e12b58f8982aa0277481e134cf96a8
Merge: c691b09 7a58a98
Author: Gregory Collins <[email protected]>
Date:   Thu Oct 21 11:10:58 2010 +0200

    Merge branch 'issue21_test' of http://github.com/wlangstroth/heist

commit 7a58a9848fd27bc2b8c5d2c4fecefaa556b40e4d
Author: stwill <[email protected]>
Date:   Tue Oct 19 18:14:35 2010 -0400

    added test for issue21, test template

diff --git a/test/suite/Text/Templating/Heist/Tests.hs 
b/test/suite/Text/Templating/Heist/Tests.hs
index ab79611..f7caa23 100644
--- a/test/suite/Text/Templating/Heist/Tests.hs
+++ b/test/suite/Text/Templating/Heist/Tests.hs
@@ -40,7 +40,8 @@ tests = [ testProperty "simpleBindTest" $ monadicIO $ forAllM 
arbitrary prop_sim
         , testCase "fsLoadTest" fsLoadTest
         , testCase "renderNoNameTest" renderNoNameTest
         , testCase "doctypeTest" doctypeTest
-        , testCase "attributeSubstitution" attrSubst
+        , testCase "attributeSubstitution" attrSubstTest
+        , testCase "bindAttribute" attrSubstTest
         , testCase "applyTest" applyTest
         ]
 
@@ -76,7 +77,7 @@ loadTest = do
   ets <- loadT "templates"
   either (error "Error loading templates")
          (\ts -> do let tm = _templateMap ts
-                    H.assertBool "loadTest size" $ Map.size tm == 15
+                    H.assertBool "loadTest size" $ Map.size tm == 16
          ) ets
 
 renderNoNameTest :: H.Assertion
@@ -114,8 +115,8 @@ doctypeTest = do
     ioc <- renderTemplate ts "ioc"
     H.assertBool "doctype test ioc" $ hasDoctype $ fromJust ioc
 
-attrSubst :: H.Assertion
-attrSubst = do
+attrSubstTest :: H.Assertion
+attrSubstTest = do
     ets <- loadT "templates"
     let ts = either (error "Error loading templates") id ets
     check (setTs "meaning_of_everything" ts) "pre_meaning_of_everything_post"
@@ -129,6 +130,21 @@ attrSubst = do
         H.assertBool ("attr subst foo") $
             not $ B.null $ snd $ B.breakSubstring "$(foo)" $ fromJust res
 
+
+bindAttrTest :: H.Assertion
+bindAttrTest = do
+    ets <- loadT "templates"
+    let ts = either (error "Error loading templates") id ets
+    check ts "pre__post"
+  where
+    check ts str = do
+        res <- renderTemplate ts "bind-attrs"
+        H.assertBool ("attr subst " ++ (show str)) $
+            not $ B.null $ snd $ B.breakSubstring str $ fromJust res
+        H.assertBool ("attr subst bar") $
+            not $ B.null $ snd $ B.breakSubstring "$(bar)" $ fromJust res
+
+
 -- dotdotTest :: H.Assertion
 -- dotdotTest = do
 --   ets <- loadT "templates"
diff --git a/test/templates/bind-attrs.tpl b/test/templates/bind-attrs.tpl
new file mode 100644
index 0000000..c5cd7ea
--- /dev/null
+++ b/test/templates/bind-attrs.tpl
@@ -0,0 +1,2 @@
+<bind tag="bar">meaning_of_everything</bind>
+<div id="$(bar)"> </div>
-----------------------------------------------------------------------


hooks/post-receive
-- 
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to