mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 02:23:59 +02:00
Revert r36699 and r36700. [Feature #6130]
Revert "Kernel#inspect: improve consistency and do not call #to_s." Revert "update PP with recent Kernel#inspect change. Patch by Yusuke Endoh." r36699 cause test-all failure on test/drb/test_drb.rb and test/drb/test_drbssl.rb. Run test-all before commit. Moreover its ChangeLog formst is wrong: see CommitterHowto https://bugs.ruby-lang.org/projects/ruby/wiki/CommitterHowto#ChangeLog git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e1aa72d441
commit
780e7d0951
10 changed files with 37 additions and 67 deletions
|
@ -690,31 +690,6 @@ class TestObject < Test::Unit::TestCase
|
|||
assert_equal(true, s.tainted?)
|
||||
end
|
||||
|
||||
def test_inspect
|
||||
x = Object.new
|
||||
assert_match(/\A#<Object:0x\h+>\z/, x.inspect)
|
||||
|
||||
x.instance_variable_set(:@ivar, :value)
|
||||
assert_match(/\A#<Object:0x\h+ @ivar=:value>\z/, x.inspect)
|
||||
|
||||
x = Object.new
|
||||
x.instance_variable_set(:@recur, x)
|
||||
assert_match(/\A#<Object:0x\h+ @recur=#<Object:0x\h+ \.\.\.>>\z/, x.inspect)
|
||||
|
||||
x = Object.new
|
||||
x.instance_variable_set(:@foo, "value")
|
||||
x.instance_variable_set(:@bar, 42)
|
||||
assert_match(/\A#<Object:0x\h+ (?:@foo="value", @bar=42|@bar=42, @foo="value")>\z/, x.inspect)
|
||||
|
||||
# #inspect does not call #to_s anymore
|
||||
feature6130 = '[ruby-core:43238]'
|
||||
x = Object.new
|
||||
def x.to_s
|
||||
"to_s"
|
||||
end
|
||||
assert_match(/\A#<Object:0x\h+>\z/, x.inspect, feature6130)
|
||||
end
|
||||
|
||||
def test_exec_recursive
|
||||
Thread.current[:__recursive_key__] = nil
|
||||
a = [[]]
|
||||
|
|
|
@ -118,6 +118,7 @@ class PPInspectTest < Test::Unit::TestCase
|
|||
def a.to_s() "aaa" end
|
||||
result = PP.pp(a, '')
|
||||
assert_equal("#{a.inspect}\n", result)
|
||||
assert_equal("aaa\n", result)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue