summaryrefslogtreecommitdiff
path: root/test/ruby/test_super.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_super.rb')
-rw-r--r--test/ruby/test_super.rb24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 418f293f66..25bad2242a 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -654,8 +654,13 @@ class TestSuper < Test::Unit::TestCase
assert_equal(1, c.new.test(1))
b.class_eval do
- def test
- :test
+ begin
+ verbose_bak, $VERBOSE = $VERBOSE, nil
+ def test
+ :test
+ end
+ ensure
+ $VERBOSE = verbose_bak
end
end
@@ -754,4 +759,19 @@ class TestSuper < Test::Unit::TestCase
inherited = inherited_class.new
assert_equal 2, inherited.test # it may read index=1 while it should be index=2
end
+
+ def test_super_in_basic_object
+ assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
+ begin;
+ class ::BasicObject
+ def no_super
+ super()
+ rescue ::NameError
+ :ok
+ end
+ end
+
+ assert_equal :ok, "[Bug #21694]".no_super
+ end;
+ end
end