Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.0.1
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:WindowsXP SP2, Mac OSX 10.4, JDK6
-
Testcase included:yes
-
Number of attachments :
Description
Looks like the yaml serilization has some problem when there is a nested yaml serialized string
require 'test/unit'
require 'active_support'
require 'yaml'
class TestRoundTripSerialization < Test::Unit::TestCase
def test_roundtrip_serialization_with_yaml
hash = HashWithIndifferentAccess.new
hash['kind'] = 'human'
need_to_be_serialized = {:first => 'something', :second_params => hash}
a = {:x => need_to_be_serialized.to_yaml}
assert_equal need_to_be_serialized, YAML.load(YAML.load(a.to_yaml)[:x])
end
end
This testcase failed both on macos and windows xp. But the behavior is kind of differen on two platform. Sometime I got extra '\' on the serialized yaml string on windows.
Fixed by not emitting the strange constructs using escaped spaces inside of double quoted strings. Instead, use | for output in the case of multiline, matching MRI on this.