Showing posts with label bug. Show all posts
Showing posts with label bug. Show all posts

Monday, May 19, 2008

portation of spec tests

Today, I port all the spec tests about yaml from rubinius to rbyaml.
In order to make all of them could be passed smoothly by rbyaml library, I fixed three small bugs.
1. As RbYAML.tagged_classes, Given int tag uri, Should return Integer .
RbYAML.tagged_classes["tag:yaml.org,2002:int"].should == Integer

2. As Symbol.to_yaml, Should return symbol YAML representation.
:symbol.to_yaml.should == "--- :symbol\n"

3. As RbYAML, Should have tagurize method.
RbYAML.tagurize('wtf').should == "tag:yaml.org,2002:wtf"
RbYAML.tagurize(1).should == 1

Rubinius and Syck really help me a lot during improving rbyaml.
Thank them.

Sunday, May 11, 2008

symbol parsing bug has been fixed

In my opinion, maybe rbyaml is ported from pyyaml. And in Python, there is no symbol class. So rbyaml doesn't support symbol parsing at first.

This week, I worked on symbol parsing bug. I spent lots of time on tracking the stream parsing flow with ruby-debug. During the tracking process, I added some spec tests to cover the method call stack.
After I find out the fixing solution. Then I found that bug had been fixed already in rubinius. It really helped me a lot.
Now, RbYAML can parse stream which inlcude symbol smoothly.
You can try it by following code.
RbYAML.load("---\n :firstname: Long\n lastname: Sun")
=> {:firstname=>"Long", "lastname"=>"Sun"}

Wednesday, May 7, 2008

syck bug

These days, I am working on symbol parsing.
I found a bug of syck.
In the document of ruby,
  YAML.parse( "--- :locked" )
#=> # @type_id="tag:ruby.yaml.org,2002:sym",
@value=":locked", @kind=:scalar>
but in fact,
irb(main):002:0> YAML.parse("--- :symbol").type_id
=> "tag:yaml.org,2002:str"

Monday, May 5, 2008

load symbol as string

Currently, I think loading symbol as string is a defect of rbyaml.
For example,
>RbYAML.load("--- :sym")
=> ":sym" # It's a string
>YAML.load("--- :sym")
=> :sym # It's a symbol


Starting working on that defect.
You can see more tasks and defects in following URL,
http://code.google.com/p/rbyaml/issues/list