2017-07-14 02:15:58 -04:00
|
|
|
# frozen_string_literal: true
|
2013-03-26 10:55:04 -04:00
|
|
|
require_relative 'helper'
|
2010-03-28 17:49:37 -04:00
|
|
|
|
|
|
|
module Psych
|
|
|
|
class TestClass < TestCase
|
2011-06-08 20:22:33 -04:00
|
|
|
module Foo
|
|
|
|
end
|
|
|
|
|
2011-06-08 20:06:29 -04:00
|
|
|
def test_cycle_anonymous_class
|
2021-05-10 06:09:17 -04:00
|
|
|
assert_raise(::TypeError) do
|
2011-06-08 20:06:29 -04:00
|
|
|
assert_cycle(Class.new)
|
2010-03-28 17:49:37 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-08 20:22:33 -04:00
|
|
|
def test_cycle_anonymous_module
|
2021-05-10 06:09:17 -04:00
|
|
|
assert_raise(::TypeError) do
|
2011-06-08 20:22:33 -04:00
|
|
|
assert_cycle(Module.new)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-06-08 20:06:29 -04:00
|
|
|
def test_cycle
|
|
|
|
assert_cycle(TestClass)
|
|
|
|
end
|
|
|
|
|
2010-03-28 17:49:37 -04:00
|
|
|
def test_dump
|
2011-06-08 20:06:29 -04:00
|
|
|
Psych.dump TestClass
|
2010-03-28 17:49:37 -04:00
|
|
|
end
|
2011-06-08 20:22:33 -04:00
|
|
|
|
|
|
|
def test_cycle_module
|
|
|
|
assert_cycle(Foo)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_dump_module
|
|
|
|
Psych.dump Foo
|
|
|
|
end
|
2010-03-28 17:49:37 -04:00
|
|
|
end
|
|
|
|
end
|