2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2015-12-08 00:20:41 -05:00
|
|
|
require 'test/unit'
|
|
|
|
require '-test-/marshal/internal_ivar'
|
|
|
|
|
|
|
|
module Bug end
|
|
|
|
|
|
|
|
module Bug::Marshal
|
|
|
|
class TestInternalIVar < Test::Unit::TestCase
|
|
|
|
def test_marshal
|
2019-08-10 00:18:41 -04:00
|
|
|
v = InternalIVar.new("hello", "world", "bye")
|
2015-12-08 00:20:41 -05:00
|
|
|
assert_equal("hello", v.normal)
|
|
|
|
assert_equal("world", v.internal)
|
2019-08-10 00:18:41 -04:00
|
|
|
assert_equal("bye", v.encoding_short)
|
|
|
|
dump = assert_warn(/instance variable `E' on class \S+ is not dumped/) {
|
|
|
|
::Marshal.dump(v)
|
|
|
|
}
|
2015-12-08 00:20:41 -05:00
|
|
|
v = assert_nothing_raised {break ::Marshal.load(dump)}
|
|
|
|
assert_instance_of(InternalIVar, v)
|
|
|
|
assert_equal("hello", v.normal)
|
|
|
|
assert_nil(v.internal)
|
2019-08-10 00:18:41 -04:00
|
|
|
assert_nil(v.encoding_short)
|
2015-12-08 00:20:41 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|