1 # frozen_string_literal: true
2 require_relative 'helper'
5 class TestSerializeSubclasses < TestCase
7 def initialize one, two
13 @one == other.instance_eval { @one } &&
14 @two == other.instance_eval { @two }
19 so = SomeObject.new('foo', [1,2,3])
20 assert_equal so, Psych.unsafe_load(Psych.dump(so))
23 class StructSubclass < Struct.new(:foo)
24 def initialize foo, bar
30 super(other) && @bar == other.instance_eval{ @bar }
34 def test_struct_subclass
35 so = StructSubclass.new('foo', [1,2,3])
36 assert_equal so, Psych.unsafe_load(Psych.dump(so))