From 7e8da46abac090b44726946d8e3275f7b9361953 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 27 Jun 2012 11:30:38 -0400 Subject: [PATCH] Fix up the absolute URI functions/tests. --- src/LWN/URI.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/LWN/URI.hs b/src/LWN/URI.hs index 5b8d8fa..5e61eb6 100644 --- a/src/LWN/URI.hs +++ b/src/LWN/URI.hs @@ -5,10 +5,11 @@ import Data.Maybe (fromJust) import Data.String.Utils (split) import Network.URI ( URI(..), + URIAuth(..), parseAbsoluteURI, parseURIReference, relativeTo, - uriRegName, + uriRegName ) import Test.HUnit (Assertion, assertEqual) import Test.Framework (Test, testGroup) @@ -121,8 +122,11 @@ make_absolute_uri :: URI -> Maybe URI make_absolute_uri relative_uri = relativeTo relative_uri base_uri where - base_uri = URI { uriScheme = "https://", - uriAuthority = "lwn.net", + base_auth = URIAuth { uriUserInfo = "", + uriRegName = "lwn.net", + uriPort = "" } + base_uri = URI { uriScheme = "https:", + uriAuthority = Just base_auth, uriPath = "/", uriQuery = "", uriFragment = "" } @@ -136,9 +140,9 @@ make_absolute_url relative_url = let abs_result = make_absolute_uri relative_uri in case abs_result of Nothing -> Nothing - Just abs_uri -> show abs_uri + Just abs_uri -> Just $ show abs_uri where - parse_result = parseURIReference url + parse_result = parseURIReference relative_url -- 2.44.2