mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
range.c: infected by the receiver
* 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/trunk@52868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1c7f75793d
commit
f7fb4e00f7
3 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 3 14:22:16 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]
|
||||
|
||||
Thu Dec 3 11:57:12 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in: separate SET_CURRENT_THREAD_NAME, which can set
|
||||
|
|
4
range.c
4
range.c
|
@ -1074,7 +1074,7 @@ range_to_s(VALUE range)
|
|||
str = rb_str_dup(str);
|
||||
rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
|
||||
rb_str_append(str, str2);
|
||||
OBJ_INFECT(str, str2);
|
||||
OBJ_INFECT(str, range);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
@ -1092,7 +1092,7 @@ inspect_range(VALUE range, VALUE dummy, int recur)
|
|||
str = rb_str_dup(str);
|
||||
rb_str_cat(str, "...", EXCL(range) ? 3 : 2);
|
||||
rb_str_append(str, str2);
|
||||
OBJ_INFECT(str, str2);
|
||||
OBJ_INFECT(str, range);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
|
|
@ -283,11 +283,21 @@ class TestRange < Test::Unit::TestCase
|
|||
def test_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
|
||||
|
||||
def test_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
|
||||
|
||||
def test_eqq
|
||||
|
|
Loading…
Add table
Reference in a new issue