reroute 0.2.2.0 → 0.2.2.1
raw patch · 4 files changed
+27/−24 lines, 4 filesdep ~basedep ~hspecdep ~mtl
Dependency ranges changed: base, hspec, mtl, regex-compat, text, unordered-containers, vector
Files
- reroute.cabal +22/−23
- src/Web/Routing/AbstractRouter.hs +1/−1
- test/Web/Routing/SafeRoutingSpec.hs +2/−0
- test/Web/Routing/TextRoutingSpec.hs +2/−0
reroute.cabal view
@@ -1,5 +1,5 @@ name: reroute-version: 0.2.2.0+version: 0.2.2.1 synopsis: abstract implementation of typed and untyped web routing description: abstraction over how urls with/without parameters are mapped to their corresponding handlers homepage: http://github.com/agrafix/reroute@@ -13,22 +13,24 @@ cabal-version: >=1.10 library- exposed-modules: Data.HVect,+ exposed-modules:+ Data.HVect, Data.PolyMap, Web.Routing.AbstractRouter, Web.Routing.SafeRouting, Web.Routing.TextRouting- build-depends: base >=4.6 && <4.8,- transformers >=0.3,- text >= 0.11.3.1,- unordered-containers ==0.2.*,- regex-compat ==0.95.*,+ build-depends:+ base >=4.6 && <5,+ deepseq >= 1.1.0.2,+ graph-core >=0.2.1, hashable >=1.2, mtl >=2.1, path-pieces >=0.1,- vector >=0.10,- deepseq >= 1.1.0.2,- graph-core >=0.2.1+ regex-compat >=0.95,+ text >= 0.11.3.1,+ transformers >=0.3,+ unordered-containers >=0.2,+ vector >=0.10 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall -fno-warn-orphans@@ -38,20 +40,17 @@ type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs- other-modules: Web.Routing.SafeRoutingSpec, Web.Routing.TextRoutingSpec- build-depends: base >=4.6 && <4.8,+ other-modules:+ Web.Routing.SafeRoutingSpec,+ Web.Routing.TextRoutingSpec+ build-depends:+ base,+ hspec,+ mtl, reroute,- transformers >=0.3,- text >= 0.11.3.1,- unordered-containers ==0.2.*,- regex-compat ==0.95.*,- hashable >=1.2,- mtl >=2.1,- path-pieces >=0.1,- hspec == 2.*,- vector >=0.10,- deepseq >= 1.1.0.2,- graph-core >=0.2.1+ text,+ unordered-containers,+ vector default-language: Haskell2010 ghc-options: -Wall -fno-warn-orphans
src/Web/Routing/AbstractRouter.hs view
@@ -101,7 +101,7 @@ case HM.lookup ty hm of Nothing -> [] Just registry ->- matchRoute registry route+ matchRoute registry (filter (not . T.null) route) initSt = RegistryState { rs_registry = HM.empty
test/Web/Routing/SafeRoutingSpec.hs view
@@ -29,9 +29,11 @@ describe "SafeRouting Spec" $ do it "should match known routes" $ do checkRoute "" [StrVar "root"]+ checkRoute "/" [StrVar "root"] checkRoute "/bar" [StrVar "bar"] it "should capture variables in routes" $ do checkRoute "/bar/23/baz" [IntVar 23]+ checkRoute "/bar/23/baz/" [IntVar 23] checkRoute "/bar/23/baz/100" [ListVar [IntVar 23, IntVar 100]] checkRoute "/bar/23/100" [ListVar [IntVar 23, IntVar 100]] checkRoute "/entry/344/2014-20-14T12:23" [ListVar [IntVar 344, StrVar "2014-20-14T12:23"]]
test/Web/Routing/TextRoutingSpec.hs view
@@ -29,8 +29,10 @@ do it "shouldn't match unknown routes" $ do matchRoute "random" routingTree `shouldBe` noMatches matchRoute "/baz" routingTree `shouldBe` noMatches+ matchRoute "/baz/" routingTree `shouldBe` noMatches it "should match known routes" $ do matchRoute "/" routingTree `shouldBe` oneMatch emptyParamMap [1]+ matchRoute "" routingTree `shouldBe` oneMatch emptyParamMap [1] matchRoute "/bar" routingTree `shouldBe` oneMatch emptyParamMap [2] it "should capture variables in routes" $ do matchRoute "/bar/5" routingTree `shouldBe` oneMatch (vMap [("baz", "5")]) [3]