diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_array.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index eacc0b007b..f27b8a5724 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -805,6 +805,15 @@ class TestArray < Test::Unit::TestCase assert_nothing_raised(RuntimeError, bug10748) {a.flatten(1)} end + def test_flattern_singleton_class + bug12738 = '[ruby-dev:49781] [Bug #12738]' + a = [[0]] + class << a + def m; end + end + assert_raise(NoMethodError, bug12738) { a.flatten.m } + end + def test_flatten! a1 = @cls[ 1, 2, 3] a2 = @cls[ 5, 6 ] @@ -842,6 +851,15 @@ class TestArray < Test::Unit::TestCase assert_nothing_raised(RuntimeError, bug10748) {a.flatten!(1)} end + def test_flattern_singleton_class! + bug12738 = '[ruby-dev:49781] [Bug #12738]' + a = [[0]] + class << a + def m; end + end + assert_nothing_raised(NameError, bug12738) { a.flatten!.m } + end + def test_flatten_with_callcc need_continuation o = Object.new |