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
625 626 627 628 |
# File 'lib/pp.rb', line 625 def test_anonymous a = Class.new.new assert_equal(a.inspect + "\n", PP.pp(a, '')) end |
#test_array ⇒ Object
597 598 599 600 601 602 |
# File 'lib/pp.rb', line 597 def test_array a = [] a << a assert_equal("[[...]]\n", PP.pp(a, '')) assert_equal("#{a.inspect}\n", PP.pp(a, '')) end |
#test_hash ⇒ Object
604 605 606 607 608 609 |
# File 'lib/pp.rb', line 604 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
619 620 621 622 623 |
# File 'lib/pp.rb', line 619 def test_object a = Object.new a.instance_eval {@a = a} assert_equal(a.inspect + "\n", PP.pp(a, '')) end |
#test_share_nil ⇒ Object
637 638 639 640 641 642 643 644 645 |
# File 'lib/pp.rb', line 637 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 |