rubyspec: Ruby character strings interpolates the return value of Object#inspect, without ivars, if Object#to_s does not return a String instance ERROR
Ruby character strings interpolates the return value of Object#inspect, without ivars, if Object#to_s does not return a String instance ERROR
ArgumentError: wrong number of arguments(2 for 1)
/home/mame/work/ruby/spec/rubyspec/language/string_spec.rb:158:in []' /home/mame/work/ruby/spec/rubyspec/language/string_spec.rb:158:in block (2 levels) in <top (required)>'
/home/mame/work/ruby/spec/rubyspec/language/string_spec.rb:5:in `<top (required)>'
In message "Re: [Bug #2658] rubyspec: Ruby character strings interpolates the return value of Object#inspect, without ivars, if Object#to_s does not return a String instance ERROR"
on Tue, 26 Jan 2010 20:39:56 +0900, Yusuke Endoh redmine@ruby-lang.org writes:
In message "Re: [ruby-dev:40164] Re: [Bug #2658] rubyspec: Ruby character strings interpolates the return value of Object#inspect, without ivars, if Object#to_s does not return a String instance ERROR"
on Tue, 26 Jan 2010 22:41:55 +0900, Yusuke ENDOH mame@tsg.ne.jp writes:
From f86b412e1a52e2cd469abee2e8bad1a7627befe8 Mon Sep 17 00:00:00 2001
From: Yuki Sonoda (Yugui) yugui@yugui.jp
Date: Sat, 30 Jan 2010 12:34:02 +0900
Subject: [PATCH] The spec for interporation when Object#to_s did not return a String
was confusing the default representation of an arbitrary object and
Object#inspect.
diff --git a/language/string_spec.rb b/language/string_spec.rb
index c168e53..5a469ce 100644
--- a/language/string_spec.rb
+++ b/language/string_spec.rb
@@ -150,12 +150,13 @@ HERE
"#{obj}".should == '42'
end
it "interpolates the return value of Object#inspect, without ivars, if Object#to_s does not return a String instance" do
it "interpolates an implementation depended representation of an object if the object does not return a String for #to_s and the representation of the object is not empty" do
obj = mock('to_s')
obj.stub!(:to_s).and_return(42)