mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
* array.c (rb_ary_push_m, rb_ary_unshift_m, rb_ary_aset),
(rb_ary_insert, rb_ary_replace, rb_ary_concat), (rb_ary_uniq_bang, rb_ary_flatten_bang): check if frozen after wrong number of arguments but before TypeError. [ruby-core:28140] * hash.c (rb_hash_replace): ditto. * string.c (rb_str_replace): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6942afef5f
commit
f3f43cdbee
7 changed files with 79 additions and 10 deletions
|
@ -875,6 +875,12 @@ class TestString < Test::Unit::TestCase
|
|||
s2 = ["foo"].pack("p")
|
||||
s.replace(s2)
|
||||
assert_equal(s2, s)
|
||||
|
||||
fs = "".freeze
|
||||
assert_raise(RuntimeError) { fs.replace("a") }
|
||||
assert_raise(RuntimeError) { fs.replace(fs) }
|
||||
assert_raise(ArgumentError) { fs.replace() }
|
||||
assert_raise(RuntimeError) { fs.replace(42) }
|
||||
end
|
||||
|
||||
def test_reverse
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue