diff options
author | Luke Gruber <luke.gru@gmail.com> | 2019-06-22 18:37:08 -0400 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-23 08:05:13 +0900 |
commit | ec8e5f5aa64e2a54cf1e303f2b012c98e8d521ba (patch) | |
tree | b8e7a123b5a179ae1319e8157ee34273a639b24d /test/ruby/test_array.rb | |
parent | 3840791b7ebb2442724d96c69a791d0e678fbc6c (diff) |
array.c: always check frozenness in Array#unshift. Fixes [Bug #15952]
Closes: https://github.com/ruby/ruby/pull/2251
Diffstat (limited to 'test/ruby/test_array.rb')
-rw-r--r-- | test/ruby/test_array.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index 88d61b79e0..b1778d191c 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -1958,6 +1958,17 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[@cls[1,2], nil, 'dog', 'cat'], a.unshift(@cls[1, 2])) end + def test_unshift_frozen + bug15952 = '[Bug #15952]' + assert_raise(FrozenError, bug15952) do + a = [1] * 100 + b = a[4..-1] + a.replace([1]) + b.freeze + b.unshift("a") + end + end + def test_OR # '|' assert_equal(@cls[], @cls[] | @cls[]) assert_equal(@cls[1], @cls[1] | @cls[]) |