Sean,

> On 12 Mar 2015, at 22:33, Sean P. DeNigris <[email protected]> wrote:
> 
> On Mar 12, 2015, at 5:30 PM, Sven Van Caekenberghe-2 [via Smalltalk] <[hidden 
> email]> wrote: 
> > I think that what we have now is correct. I am willing to change my mind 
> > when you point to some RFC that supports your point ;-) 
> Well in that case… 
> 
> ^ Response new 
>         emoticon: ':-P’; 
>         sound: Sound raspberry; 
>         yourself.
> Cheers, 
> Sean
> 
> View this message in context: Re: ZnUrl: Constructing without Scheme
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

I do not entirely understand, but anyway, I just committed this:

===
Name: Zinc-Resource-Meta-Tests-SvenVanCaekenberghe.33
Author: SvenVanCaekenberghe
Time: 13 March 2015, 4:38:39.625508 pm
UUID: dbf5fd62-d9b2-48be-a1bb-cd22dec62852
Ancestors: Zinc-Resource-Meta-Tests-SvenVanCaekenberghe.32

Replace ZnUrlTests>>#testMissingScheme by the more extensive 
ZnUrlTests>>#testNoScheme - an attempt to make it more explicit using external 
test code why, when there is no scheme, there is no host:port interpretation, 
but instead the input is seen a a path 

Add ZnUrlTests>>#testDefaultPortUnknownScheme
===

Maybe this makes it easier to understand why things are the way they are.

ZnUrlTests>>#testNoScheme
  "When there is no scheme, there is no host:port interpretation, 
  but instead the input is seen a a path - externalize this in test code"
        
  #('foo' 'localhost' 'www.foo.com' 'foo.txt' 'foo:1') do: [ :input | 
     | url |
     url := input asZnUrl.
     self deny: url hasScheme.
     self deny: url hasHost.
     self deny: url hasPort.
     self deny: url hasQuery.
     self deny: url hasFragment.
     self assert: url hasPath.
     self assert: url isFilePath.
     self assert: url firstPathSegment equals: input ].

   #('/dir/foo.txt' 'dir/foo.txt') do: [ :input | 
     | url |
     url := input asZnUrl.
     self deny: url hasScheme.
     self deny: url hasHost.
     self deny: url hasPort.
     self deny: url hasQuery.
     self deny: url hasFragment.
     self assert: url hasPath.
     self assert: url isFilePath.
     self assert: url pathSegments equals: #('dir' 'foo.txt') 
asOrderedCollection ]

I think this is correct. The alternative, what you are suggesting, would make 
most if not all of the above be interpreted as hosts.

Sven


Reply via email to