@@ -59,10 +59,10 @@ testIsoURIRef = testIso URIRef.parser URIRef.print
5959testRunParseURIRefParses :: forall a . String -> Either URI RelativeRef -> TestSuite a
6060testRunParseURIRefParses = testRunParseSuccess URIRef .parser
6161
62- testRunParseURIRefFailes :: forall a . String -> TestSuite a
63- testRunParseURIRefFailes uri =
62+ testRunParseURIRefFails :: forall a . String -> TestSuite a
63+ testRunParseURIRefFails uri =
6464 test
65- (" failes to parse: " <> uri)
65+ (" fails to parse: " <> uri)
6666 (assert (" parse should fail for: " <> uri) <<< isLeft <<< URIRef .parse $ uri)
6767
6868testPrintQuerySerializes :: forall a . Query -> String -> TestSuite a
@@ -110,8 +110,8 @@ main = runTest $ suite "Data.URI" do
110110 isLeft $ runParser Host .ipv4AddressParser " 192.168.001.1"
111111
112112 suite " Scheme parser" do
113- testRunParseSuccess Scheme .parser " http" (Scheme " http" )
114- testRunParseSuccess Scheme .parser " git+ssh" (Scheme " git+ssh" )
113+ testRunParseSuccess Scheme .parser " http: " (Scheme " http" )
114+ testRunParseSuccess Scheme .parser " git+ssh: " (Scheme " git+ssh" )
115115
116116 suite " UserInfo parser" do
117117 testRunParseSuccess UserInfo .parser " user" (UserInfo " user" )
@@ -132,8 +132,14 @@ main = runTest $ suite "Data.URI" do
132132 testRunParseSuccess Port .parser " 63174" (Port 63174 )
133133
134134 suite " Authority parser" do
135- testRunParseSuccess Authority .parser " localhost" (Authority Nothing [Tuple (NameAddress " localhost" ) Nothing ])
136- testRunParseSuccess Authority .parser " localhost:3000" (Authority Nothing [Tuple (NameAddress " localhost" ) (Just (Port 3000 ))] )
135+ testRunParseSuccess
136+ Authority .parser
137+ " //localhost"
138+ (Authority Nothing [Tuple (NameAddress " localhost" ) Nothing ])
139+ testRunParseSuccess
140+ Authority .parser
141+ " //localhost:3000"
142+ (Authority Nothing [Tuple (NameAddress " localhost" ) (Just (Port 3000 ))] )
137143
138144 suite " URIRef.parse" do
139145 testIsoURIRef
@@ -321,6 +327,14 @@ main = runTest $ suite "Data.URI" do
321327 (HierarchicalPart (Just (Authority Nothing [(Tuple (NameAddress " example.com" ) (Just (Port 8042 )))] )) (Just (Right ((rootDir </> dir " over" ) </> file " there" ))))
322328 (Just (Query (singleton (Tuple " name" (Just " ferret" )))))
323329 (Just (Fragment " nose" ))))
330+ testIsoURIRef
331+ " foo://example.com:8042/over/there?name=ferret#"
332+ (Left
333+ (URI
334+ (Just (Scheme " foo" ))
335+ (HierarchicalPart (Just (Authority Nothing [(Tuple (NameAddress " example.com" ) (Just (Port 8042 )))] )) (Just (Right ((rootDir </> dir " over" ) </> file " there" ))))
336+ (Just (Query (singleton (Tuple " name" (Just " ferret" )))))
337+ (Just (Fragment " " ))))
324338 testIsoURIRef
325339 " foo://info.example.com?fred"
326340 (Left
@@ -408,6 +422,25 @@ main = runTest $ suite "Data.URI" do
408422 ((Just (Right (rootDir </> dir " metadata" </> dir " fs" </> dir " test" </> file " Пациенты# #" )))))
409423 (Just mempty)
410424 Nothing ))
425+ testIsoURIRef
426+ " /top_story.htm"
427+ (Left
428+ (URI
429+ Nothing
430+ (HierarchicalPart
431+ Nothing
432+ (Just (Right (rootDir </> file " top_story.htm" ))))
433+ Nothing
434+ Nothing ))
435+ testIsoURIRef
436+ " ../top_story.htm"
437+ (Right
438+ (RelativeRef
439+ (RelativePart
440+ Nothing
441+ (Just (Right (parentDir' currentDir </> file " top_story.htm" ))))
442+ Nothing
443+ Nothing ))
411444
412445 -- Not an iso in this case as the printed path is normalised
413446 testRunParseURIRefParses
@@ -432,12 +465,11 @@ main = runTest $ suite "Data.URI" do
432465 ((Just mempty))
433466 ((Just (Fragment " ?sort=asc&q=path:/&salt=1177214" )))))
434467
435- testRunParseURIRefFailes " news:comp.infosystems.www.servers.unix"
436- testRunParseURIRefFailes " tel:+1-816-555-1212"
437- testRunParseURIRefFailes " urn:oasis:names:specification:docbook:dtd:xml:4.1.2"
438- testRunParseURIRefFailes " mailto:John.Doe@example.com"
439- testRunParseURIRefFailes " mailto:fred@example.com"
440- testRunParseURIRefFailes " /top_story.htm"
468+ testRunParseURIRefFails " news:comp.infosystems.www.servers.unix"
469+ testRunParseURIRefFails " tel:+1-816-555-1212"
470+ testRunParseURIRefFails " urn:oasis:names:specification:docbook:dtd:xml:4.1.2"
471+ testRunParseURIRefFails " mailto:John.Doe@example.com"
472+ testRunParseURIRefFails " mailto:fred@example.com"
441473
442474 suite " Query.print" do
443475 testPrintQuerySerializes
@@ -456,16 +488,16 @@ main = runTest $ suite "Data.URI" do
456488
457489 suite " Query.parser" do
458490 testParseQueryParses
459- " key1=value1&key2=value2&key1=value3"
491+ " ? key1=value1&key2=value2&key1=value3"
460492 (Query (Tuple " key1" (Just " value1" ) : Tuple " key2" (Just " value2" ) : Tuple " key1" (Just " value3" ) : Nil ))
461493 testParseQueryParses
462- " key1&key2"
494+ " ? key1&key2"
463495 (Query (Tuple " key1" Nothing : Tuple " key2" Nothing : Nil ))
464496 testParseQueryParses
465- " key1=&key2="
497+ " ? key1=&key2="
466498 (Query (Tuple " key1" (Just " " ) : Tuple " key2" (Just " " ) : Nil ))
467499 testParseQueryParses
468- " key1=foo%3Bbar"
500+ " ? key1=foo%3Bbar"
469501 (Query (Tuple " key1" (Just " foo;bar" ) : Nil ))
470502
471503 suite " Common.match1From" do
0 commit comments