summaryrefslogtreecommitdiff
path: root/test/psych/test_class.rb
blob: 4e1fd4a1d6961b2c6e18e8d0ce859256e4a170be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: false
require_relative 'helper'

module Psych
  class TestClass < TestCase
    module Foo
    end

    def test_cycle_anonymous_class
      assert_raises(::TypeError) do
        assert_cycle(Class.new)
      end
    end

    def test_cycle_anonymous_module
      assert_raises(::TypeError) do
        assert_cycle(Module.new)
      end
    end

    def test_cycle
      assert_cycle(TestClass)
    end

    def test_dump
      Psych.dump TestClass
    end

    def test_cycle_module
      assert_cycle(Foo)
    end

    def test_dump_module
      Psych.dump Foo
    end
  end
end