[MacRuby-devel] URI specs

dan sinclair dj2 at everburning.com
Sun Aug 9 20:55:06 PDT 2009


Hello,

I started poking at the URI specs to see what I could get working. The  
attached patch was required to make the specs run (URI provides 11  
arguments to initialize).

I then started taking a look at why the equality spec fails and have  
tracked it back to the dup call not returning the same values in the  
duplicate object. This can be seen by doing a self.to_s and uri.to_s  
in the normalize function of lib/uri/generic.rb.

self.to_s -> http://example.com/#fragMENT
uri.to_s ->  http://example.com/

For some reason, the fragment instance variable is being dropped from  
the duplicated object while all of the other instance variables are  
being copied over.

You can see the same behaviour with the following script

------------
class  Foo
   def initialize(a, b, c, d, e, f, g, h, i, j, k)
     @a = a
     @b = b
     @c = c
     @d = d
     @e = e
     @f = f
     @g = g
     @h = h
     @i = i
     @j = j
     @k = k
   end

   def to_s
     "#{@a} #{@b} #{@c} #{@d} #{@e} #{@f} #{@g} #{@h} #{@i} #{@j} #{@k}"
   end
end

f = Foo.new("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k")
g = f.dup

puts f.to_s
puts g.to_s
-----------

titania:test dj2$ macruby ./dup.rb
a b c d e f g h i j k
a b c d e f g h i j false

dan


-------------- next part --------------
A non-text attachment was scrubbed...
Name: vm_argc.diff
Type: application/octet-stream
Size: 723 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20090809/be5fda75/attachment.obj>
-------------- next part --------------





More information about the MacRuby-devel mailing list