packages feed

web-routes-th 0.22.1 → 0.22.2

raw patch · 3 files changed

+61/−4 lines, 3 filesdep +HUnitdep +QuickCheckdep +test-frameworkdep ~web-routesPVP ok

version bump matches the API change (PVP)

Dependencies added: HUnit, QuickCheck, test-framework, test-framework-hunit, test-framework-quickcheck2, test-framework-th, web-routes-th

Dependency ranges changed: web-routes

API changes (from Hackage documentation)

Files

Web/Routes/TH.hs view
@@ -94,7 +94,7 @@          case info of            TyConI (DataD cx _ keys cs _)    -> return $ Tagged (map conInfo cs) cx $ map conv keys            TyConI (NewtypeD cx _ keys con _)-> return $ Tagged [conInfo con] cx $ map conv keys-           _                            -> error "Invalid input"+           _                                ->  error $ "derivePathInfo - invalid input: " ++ pprint info     where conInfo (NormalC n args) = (n, length args)           conInfo (RecC n args) = (n, length args)           conInfo (InfixC _ n _) = (n, 2)
+ test/Test.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE GeneralizedNewtypeDeriving, OverloadedStrings, TemplateHaskell #-}++module Main (main) where++import Test.Framework+import Test.Framework.Providers.HUnit+import Test.Framework.Providers.QuickCheck2+import Test.Framework.TH+import Test.HUnit+import Test.QuickCheck+import Web.Routes+import Web.Routes.TH++newtype ArticleId = ArticleId Int deriving (Eq, Show, Num, PathInfo, Arbitrary)++data Sitemap+    = Home+    | Article ArticleId+    deriving (Eq, Show)++derivePathInfo ''Sitemap++instance Arbitrary Sitemap where+    arbitrary = oneof [return Home, fmap Article arbitrary]++prop_PathInfo_isomorphism :: Sitemap -> Bool+prop_PathInfo_isomorphism = pathInfoInverse_prop++case_toPathInfo :: Assertion+case_toPathInfo =+    do toPathInfo Home @?= "/home"+       toPathInfo (Article 0) @?= "/article/0"++case_fromPathInfo :: Assertion+case_fromPathInfo =+    do fromPathInfo "/home" @?= Right Home+       fromPathInfo "/article/0" @?= Right (Article 0)+       case fromPathInfo "/" :: Either String Sitemap of+         Left _ -> return ()+         url    -> assertFailure $ "expected a Left, but got: " ++ show url++main :: IO ()+main = $defaultMainGenerator
web-routes-th.cabal view
@@ -1,5 +1,5 @@ Name:             web-routes-th-Version:          0.22.1+Version:          0.22.2 License:          BSD3 License-File:     LICENSE Author:           jeremy@seereason.com@@ -7,9 +7,23 @@ Bug-Reports:      http://bugzilla.seereason.com/ Category:         Web, Language Synopsis:         Support for deriving PathInfo using Template Haskell-Cabal-Version:    >= 1.6+Cabal-Version:    >= 1.8 Build-type:       Simple +test-suite Test+  type             : exitcode-stdio-1.0+  main-is          : Test.hs+  hs-source-dirs   : test+  build-depends    : base == 4.*,+                     HUnit,+                     QuickCheck,+                     test-framework,+                     test-framework-hunit,+                     test-framework-quickcheck2,+                     test-framework-th,+                     web-routes,+                     web-routes-th+ Library         Build-Depends:    base >= 4 && < 5,                           parsec >= 2 && < 4,@@ -21,4 +35,4 @@  source-repository head     type:     darcs-    location: http://src.seereason.com/web-routes/+    location: http://hub.darcs.net/stepcut/web-routes