diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-06-20 10:45:17 +0200 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-06-20 10:45:17 +0200 |
commit | bb9ea6f1226b55a584cfcec47efeddabc230418d (patch) | |
tree | 74924cc1a3b8172906c64b50a3320f9014422cfd /tests/Template.hs | |
parent | 2282e78e9c9a6fd0919a13a11e070ac52cdce52f (diff) | |
download | hakyll-bb9ea6f1226b55a584cfcec47efeddabc230418d.tar.gz |
Add newtype for Context
Diffstat (limited to 'tests/Template.hs')
-rw-r--r-- | tests/Template.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/Template.hs b/tests/Template.hs index 9924efb..4024b6a 100644 --- a/tests/Template.hs +++ b/tests/Template.hs @@ -5,6 +5,7 @@ module Template import qualified Data.Map as M import Control.Applicative ((<$>)) import Control.Monad (replicateM) +import Data.Monoid (mempty) import Data.Binary import Test.Framework (testGroup) @@ -13,6 +14,7 @@ import Test.Framework.Providers.QuickCheck2 import Test.HUnit import Test.QuickCheck +import Text.Hakyll.Context (Context (..)) import Text.Hakyll.Internal.Template -- Template test group. @@ -58,18 +60,18 @@ prop_template_encode_id template = decode (encode template) == template -- Check we get the same sting with empty substitutions. prop_substitute_id string = - regularSubstitute (fromString string) M.empty == string + regularSubstitute (fromString string) mempty == string -- substitute test case 1. test_substitute_1 = finalSubstitute template context @?= "Banana costs $4." where template = fromString "$product costs $$$price." - context = M.fromList [("product", "Banana"), ("price", "4")] + context = Context $ M.fromList [("product", "Banana"), ("price", "4")] -- substitute test case 2. test_substitute_2 = regularSubstitute template context @?= "$$root is a special key." where template = fromString "$$root is a special $thing." - context = M.fromList [("root", "foo"), ("thing", "key")] + context = Context $ M.fromList [("root", "foo"), ("thing", "key")] |