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