yesod-routes 1.2.0.4 → 1.2.0.5
raw patch · 2 files changed
+22/−2 lines, 2 files
Files
- test/Hierarchy.hs +21/−1
- yesod-routes.cabal +1/−1
test/Hierarchy.hs view
@@ -24,7 +24,7 @@ import Yesod.Routes.Class import Language.Haskell.TH.Syntax import qualified Yesod.Routes.Class as YRC-import Data.Text (Text, pack, append)+import Data.Text (Text, pack, unpack, append) import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as S8 @@ -87,6 +87,7 @@ /spaces SpacedR GET /nest2 Nest2:+ / GetPostR GET POST /get Get2 GET /post Post2 POST -- /#Int Delete2 DELETE@@ -152,6 +153,13 @@ getTableR :: Int -> Text -> Handler site Text getTableR _ = append "TableR " +getGetPostR :: Handler site Text+getGetPostR = pack "get"++postGetPostR :: Handler site Text+postGetPostR = pack "post"++ hierarchy :: Spec hierarchy = describe "hierarchy" $ do it "nested with spacing" $@@ -167,6 +175,18 @@ , envSub = Hierarchy }) (map pack ps, S8.pack m)++ let testGetPost route getRes postRes = do+ let routeStrs = map unpack $ fst (renderRoute route)+ disp "GET" routeStrs @?= (getRes, Just route)+ disp "POST" routeStrs @?= (postRes, Just route)++ it "dispatches routes with multiple METHODs: admin" $+ testGetPost (AdminR 1 LoginR) "login: 1" "post login: 1"++ it "dispatches routes with multiple METHODs: nesting" $+ testGetPost (NestR $ Nest2 GetPostR) "get" "post"+ it "dispatches root correctly" $ disp "GET" ["admin", "7"] @?= ("admin root: 7", Just $ AdminR 7 AdminRootR) it "dispatches table correctly" $ disp "GET" ["admin", "8", "table", "bar"] @?= ("TableR bar", Just $ AdminR 8 $ TableR "bar") it "parses" $ do
yesod-routes.cabal view
@@ -1,5 +1,5 @@ name: yesod-routes-version: 1.2.0.4+version: 1.2.0.5 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>