提交 4fabad7c 编写于 作者: A Aaron Patterson

test that the custom ordered hash can be round-tripped

上级 a84b84ef
begin
require 'psych'
rescue LoadError
end
require 'yaml'
YAML.add_builtin_type("omap") do |type, val|
......
......@@ -261,6 +261,23 @@ def test_order_after_yaml_serialization_with_nested_arrays
assert_equal @ordered_hash.values, @deserialized_ordered_hash.values
end
begin
require 'psych'
def test_psych_serialize
@deserialized_ordered_hash = Psych.load(Psych.dump(@ordered_hash))
values = @deserialized_ordered_hash.map { |_, value| value }
assert_equal @values, values
end
def test_psych_serialize_tag
yaml = Psych.dump(@ordered_hash)
assert_match '!omap', yaml
end
rescue LoadError
end
def test_has_yaml_tag
@ordered_hash[:array] = %w(a b c)
assert_match '!omap', YAML.dump(@ordered_hash)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册