about relative URI

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

about relative URI

Stéphane Ducasse
I decided to learn something new this evening so I started to read and write tests about URI
Now I have a question


testRelativeAuthority
        "self debug: #testRelativeAuthority"
       
        | uri relativeURIString |
        "A relative URI with authority. relative uri does not start with a scheme:."
        relativeURIString := '//www.pharo-project.org'.
        uri := URI fromString: relativeURIString.

>>> self assert: (uri asString = relativeURIString).
Is false because
        uri asString = 'www.pharo-project.org' and not '//www.pharo-project.org'

        self deny: (uri isAbsolute).
        self assert: (uri isRelative).
        self assert: (uri authority asString =  'www.pharo-project.org').
        self deny: (uri isOpaque).

So does anybody know what is correct?

Similarly

testRelativeEmptyAuthority
        "self debug: #testRelativeEmptyAuthority"
        | uri uriString |
        uriString := '//'. "A relative URI with empty (but defined) authority."
        uri := URI fromString: uriString.
        self assert: (uri asString = uriString).
>>>
        '' versus '//'
        self deny: (uri isAbsolute).
        self deny: (uri authority isNil).
        self deny: (uri isOpaque).

Thanks


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: about relative URI

Stéphane Ducasse
Similarly printOn: of URIAuthority looks borken to me
I should get
        userinfo@host
        and not  @userinfohost

So I fixed that...


testUserInfo
        "self debug: #testUserInfo"
       
        | uri uriString |
        "[scheme:][//authority][path][?query][#fragment]
        where authority can be [user-info@]host[:port]"

        uriString := 'scheme://userinfo@host/'.
        uri :=  URI fromString: uriString.
        self assert: (uri asString = uriString).
        self assert: (uri authority userInfo = 'userinfo').

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project