diff options
Diffstat (limited to 'test/psych/helper.rb')
-rw-r--r-- | test/psych/helper.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/test/psych/helper.rb b/test/psych/helper.rb index 498cdf8b09..7b564bd2d7 100644 --- a/test/psych/helper.rb +++ b/test/psych/helper.rb @@ -50,10 +50,10 @@ module Psych def assert_to_yaml( obj, yaml ) assert_equal( obj, Psych::load( yaml ) ) assert_equal( obj, Psych::parse( yaml ).transform ) - assert_equal( obj, Psych::load( obj.psych_to_yaml ) ) - assert_equal( obj, Psych::parse( obj.psych_to_yaml ).transform ) + assert_equal( obj, Psych::load( obj.to_yaml ) ) + assert_equal( obj, Psych::parse( obj.to_yaml ).transform ) assert_equal( obj, Psych::load( - obj.psych_to_yaml( + obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true ) )) @@ -70,9 +70,15 @@ module Psych def assert_cycle( obj ) v = Visitors::YAMLTree.create v << obj - assert_equal(obj, Psych.load(v.tree.yaml)) - assert_equal( obj, Psych::load(Psych.dump(obj))) - assert_equal( obj, Psych::load( obj.psych_to_yaml ) ) + if obj.nil? + assert_nil Psych.load(v.tree.yaml) + assert_nil Psych::load(Psych.dump(obj)) + assert_nil Psych::load(obj.to_yaml) + else + assert_equal(obj, Psych.load(v.tree.yaml)) + assert_equal(obj, Psych::load(Psych.dump(obj))) + assert_equal(obj, Psych::load(obj.to_yaml)) + end end # |