2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
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
|
2010-03-28 17:49:37 -04:00
|
|
|
assert_raises(::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
|
|
|
|
assert_raises(::TypeError) do
|
|
|
|
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
|