module Web.Routes.QuickCheck where
import qualified Data.Text.Encoding as Text
import Web.Routes.PathInfo (PathInfo, toPathInfo, fromPathInfo)
pathInfoInverse_prop :: (Eq url, PathInfo url) => url -> Bool
pathInfoInverse_prop :: url -> Bool
pathInfoInverse_prop url
url =
case (ByteString -> Either String url
forall url. PathInfo url => ByteString -> Either String url
fromPathInfo (ByteString -> Either String url)
-> ByteString -> Either String url
forall a b. (a -> b) -> a -> b
$ Text -> ByteString
Text.encodeUtf8 (Text -> ByteString) -> Text -> ByteString
forall a b. (a -> b) -> a -> b
$ url -> Text
forall url. PathInfo url => url -> Text
toPathInfo url
url) of
Right url
url' -> url
url url -> url -> Bool
forall a. Eq a => a -> a -> Bool
== url
url'
Either String url
_ -> Bool
False