YAML string range problem

Hi,

YAML dump/load does roundtrip for range of strings, for example:

require ‘yaml’

t = “0”…"1"
s = YAML.dump(t)
puts YAML.load(s)

gives 0…1 (range of integers). Problem might reside in
yaml/rubytypes.rb or Range#to_s, but I couldn’t fix it well.

						matz.

Hi,

From: “Yukihiro Matsumoto” matz@ruby-lang.org
Sent: Friday, March 19, 2004 2:49 PM

YAML dump/load does roundtrip for range of strings, for example:

require ‘yaml’

t = “0”…“1”
s = YAML.dump(t)
puts YAML.load(s)

gives 0…1 (range of integers). Problem might reside in
yaml/rubytypes.rb or Range#to_s, but I couldn’t fix it well.

_why, have you tried yaml test case in the ruby CVS?

And attached is another test case I haven’t added because…
Locate the file as test/yaml/test_marshal.rb in the src dir.

Regards,
// NaHi

require ‘test/unit’
require ‘yaml’
require File.join(File.dirname(File.expand_path(FILE)), ‘…/ruby/marshaltestlib’)

module YAML
module Marshal
class TestMarshal < Test::Unit::TestCase
include MarshalTestLib

def encode(o)
o.to_yaml
end

def decode(s)
YAML.load(s)
end
end
end
end

_why, have you tried yaml test case in the ruby CVS?

And attached is another test case I haven’t added because…
Locate the file as test/yaml/test_marshal.rb in the src dir.

Ok. I’m off on vacation for another three days, checking e-mail on my
handheld. I’ll get this all on Monday. I know exactly the problem. It
is in lib/yaml/rubytypes.rb.

_why

Hi,

From: “why the lucky stiff” ruby-talk@whytheluckystiff.net
Sent: Saturday, March 20, 2004 3:48 AM

_why, have you tried yaml test case in the ruby CVS?

Ok. I’m off on vacation for another three days, checking e-mail on my
handheld. I’ll get this all on Monday. I know exactly the problem. It
is in lib/yaml/rubytypes.rb.

$ cvs ann test_yaml.rb

1.10 (akira 08-Feb-04): #
1.10 (akira 08-Feb-04): # From Nobu Nakada [ruby-core:02311]
1.10 (akira 08-Feb-04): #
1.12 (nahi 16-Feb-04): t = 0…1
1.12 (nahi 16-Feb-04): assert_equal( t, YAML.load( YAML.dump( t ) ) )
1.10 (akira 08-Feb-04): t = “0”…“1”
1.11 (akira 08-Feb-04): assert_equal( t, YAML.load( YAML.dump( t ) ) )
1.11 (akira 08-Feb-04): t = “…”…“…”
1.11 (akira 08-Feb-04): assert_equal( t, YAML.load( YAML.dump( t ) ) )
1.11 (akira 08-Feb-04): t = “.rb”…“.pl”
1.11 (akira 08-Feb-04): assert_equal( t, YAML.load( YAML.dump( t ) ) )
1.11 (akira 08-Feb-04): t = “.rb”…“.pl”
1.10 (akira 08-Feb-04): assert_equal( t, YAML.load( YAML.dump( t ) ) )

So I thought that you didn’t run it or you might failed cvs
update…

Regards,
// NaHi