Class: PPCycleTest
- Defined in:
- lib/pp.rb
Defined Under Namespace
Classes: S
Instance Method Summary collapse
- #test_anonymous ⇒ Object
- #test_array ⇒ Object
- #test_hash ⇒ Object
- #test_object ⇒ Object
- #test_share_nil ⇒ Object
- #test_struct ⇒ Object
- #test_withinspect ⇒ Object
Instance Method Details
#test_anonymous ⇒ Object
618 619 620 621 |
# File 'lib/pp.rb', line 618 def test_anonymous a = Class.new.new assert_equal(a.inspect + "\n", PP.pp(a, '')) end |
#test_array ⇒ Object
590 591 592 593 594 595 |
# File 'lib/pp.rb', line 590 def test_array a = [] a << a assert_equal("[[...]]\n", PP.pp(a, '')) assert_equal("#{a.inspect}\n", PP.pp(a, '')) end |
#test_hash ⇒ Object
597 598 599 600 601 602 |
# File 'lib/pp.rb', line 597 def test_hash a = {} a[0] = a assert_equal("{0=>{...}}\n", PP.pp(a, '')) assert_equal("#{a.inspect}\n", PP.pp(a, '')) end |
#test_object ⇒ Object
612 613 614 615 616 |
# File 'lib/pp.rb', line 612 def test_object a = Object.new a.instance_eval {@a = a} assert_equal(a.inspect + "\n", PP.pp(a, '')) end |
#test_share_nil ⇒ Object
630 631 632 633 634 635 636 637 638 |
# File 'lib/pp.rb', line 630 def test_share_nil begin PP.sharing_detection = true a = [nil, nil] assert_equal("[nil, nil]\n", PP.pp(a, '')) ensure PP.sharing_detection = false end end |