Module: Insp::Etest
- Defined in:
- lib/vex/base/object/insp.rb
Defined Under Namespace
Classes: X
Instance Method Summary collapse
- #test_insp_array ⇒ Object
- #test_insp_hash ⇒ Object
- #test_insp_obj ⇒ Object
- #test_insp_string ⇒ Object
Instance Method Details
#test_insp_array ⇒ Object
91 92 93 94 |
# File 'lib/vex/base/object/insp.rb', line 91 def test_insp_array assert_equal("[1, 2]", [1,2].insp) assert_equal("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ... (10 more)]", (1..30).to_a.insp) end |
#test_insp_hash ⇒ Object
96 97 98 99 100 101 102 103 104 |
# File 'lib/vex/base/object/insp.rb', line 96 def test_insp_hash assert_equal("{}", {}.insp) h = (1..30).to_a.inject({}) do |hash, id| hash.update id => id*id end assert_equal "{1 => 1, 2 => 4, 3 => 9, 4 => 16, 5 => 25, 6 => 36, 7 => 49, 8 => 64, 9 => 81, 10 => 100, ... (20 more)}", h.insp end |
#test_insp_obj ⇒ Object
120 121 122 |
# File 'lib/vex/base/object/insp.rb', line 120 def test_insp_obj assert X.new.insp =~ /Insp::Etest::X/ end |
#test_insp_string ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/vex/base/object/insp.rb', line 106 def test_insp_string s = "123" assert_equal(s.insp, s.inspect) s = (s * 100).insp assert s.ends_with?("...\"") assert s.length < 50 end |