# PPInspectTest (Class)

In: | pp.rb
Parent: | Test::Unit::TestCase

## Methods

test_hasboth test_hasinspect test_hasprettyprint test_pretty_print_inspect test_proc test_to_s_with_iv test_to_s_without_iv

## Public Instance methods

test_hasinspect()

[Source]

    # File pp.rb, line 503
        def test_hasinspect
          a = HasInspect.new(1)
          assert_equal("<inspect:1>\n", PP.pp(a, ''))
        end

test_hasprettyprint()

[Source]

    # File pp.rb, line 508
        def test_hasprettyprint
          a = HasPrettyPrint.new(1)
          assert_equal("<pretty_print:1>\n", PP.pp(a, ''))
        end

test_hasboth()

[Source]

    # File pp.rb, line 513
        def test_hasboth
          a = HasBoth.new(1)
          assert_equal("<pretty_print:1>\n", PP.pp(a, ''))
        end

test_pretty_print_inspect()

[Source]

    # File pp.rb, line 518
        def test_pretty_print_inspect
          a = PrettyPrintInspect.new(1)
          assert_equal("<pretty_print:1>", a.inspect)
          a = PrettyPrintInspectWithoutPrettyPrint.new
          assert_raises(RuntimeError) { a.inspect }
        end

test_proc()

[Source]

    # File pp.rb, line 525
        def test_proc
          a = proc {1}
          assert_equal("#{a.inspect}\n", PP.pp(a, ''))
        end

test_to_s_with_iv()

[Source]

    # File pp.rb, line 530
        def test_to_s_with_iv
          a = Object.new
          def a.to_s() "aaa" end
          a.instance_eval { @a = nil }
          result = PP.pp(a, '')
          assert_equal("#{a.inspect}\n", result)
          assert_match(/\A#<Object.*>\n\z/m, result)
        end

test_to_s_without_iv()

[Source]

    # File pp.rb, line 539
        def  test_to_s_without_ivtest_to_s_without_iv
          a = Object.new
          def a.to_s() "aaa" end
          result = PP.pp(a, '')
          assert_equal("#{a.inspect}\n", result)
          assert_equal("aaa\n", result)
        end

[Validate]