merge revision(s) 52868: [Backport #11767]

* range.c (range_to_s): should be infected by the receiver.
	  str2 infects by appending.  [ruby-core:71811] [Bug #11767]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2015-12-03 17:56:53 +00:00
parent 8458ff3a41
commit c35409c276
4 changed files with 20 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 4 02:42:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* range.c (range_to_s): should be infected by the receiver.
str2 infects by appending. [ruby-core:71811] [Bug #11767]
Wed Dec 2 03:17:01 2015 NARUSE, Yui <naruse@ruby-lang.org> Wed Dec 2 03:17:01 2015 NARUSE, Yui <naruse@ruby-lang.org>
* ext/readline/extconf.rb: call dir_config("libedit") * ext/readline/extconf.rb: call dir_config("libedit")

View file

@ -1085,7 +1085,7 @@ range_to_s(VALUE range)
str = rb_str_dup(str); str = rb_str_dup(str);
rb_str_cat(str, "...", EXCL(range) ? 3 : 2); rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
rb_str_append(str, str2); rb_str_append(str, str2);
OBJ_INFECT(str, str2); OBJ_INFECT(str, range);
return str; return str;
} }
@ -1103,7 +1103,7 @@ inspect_range(VALUE range, VALUE dummy, int recur)
str = rb_str_dup(str); str = rb_str_dup(str);
rb_str_cat(str, "...", EXCL(range) ? 3 : 2); rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
rb_str_append(str, str2); rb_str_append(str, str2);
OBJ_INFECT(str, str2); OBJ_INFECT(str, range);
return str; return str;
} }

View file

@ -271,11 +271,21 @@ class TestRange < Test::Unit::TestCase
def test_to_s def test_to_s
assert_equal("0..1", (0..1).to_s) assert_equal("0..1", (0..1).to_s)
assert_equal("0...1", (0...1).to_s) assert_equal("0...1", (0...1).to_s)
bug11767 = '[ruby-core:71811] [Bug #11767]'
assert_predicate(("0".taint.."1").to_s, :tainted?, bug11767)
assert_predicate(("0".."1".taint).to_s, :tainted?, bug11767)
assert_predicate(("0".."1").taint.to_s, :tainted?, bug11767)
end end
def test_inspect def test_inspect
assert_equal("0..1", (0..1).inspect) assert_equal("0..1", (0..1).inspect)
assert_equal("0...1", (0...1).inspect) assert_equal("0...1", (0...1).inspect)
bug11767 = '[ruby-core:71811] [Bug #11767]'
assert_predicate(("0".taint.."1").inspect, :tainted?, bug11767)
assert_predicate(("0".."1".taint).inspect, :tainted?, bug11767)
assert_predicate(("0".."1").taint.inspect, :tainted?, bug11767)
end end
def test_eqq def test_eqq

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.2.4" #define RUBY_VERSION "2.2.4"
#define RUBY_RELEASE_DATE "2015-12-02" #define RUBY_RELEASE_DATE "2015-12-04"
#define RUBY_PATCHLEVEL 218 #define RUBY_PATCHLEVEL 219
#define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_YEAR 2015
#define RUBY_RELEASE_MONTH 12 #define RUBY_RELEASE_MONTH 12
#define RUBY_RELEASE_DAY 2 #define RUBY_RELEASE_DAY 4
#include "ruby/version.h" #include "ruby/version.h"