summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2024-02-15 20:04:23 +0900
committerYusuke Endoh <mame@ruby-lang.org>2024-02-15 20:43:11 +0900
commita7718c914a216457ca9d3806085e673eabda8b31 (patch)
tree99f122f32afba7f5c8407c6ac3eecd2bebc1c364 /test/ruby
parent0da12fa34e904603d2aa84e25924a3fde8a44f39 (diff)
Do not show an anonymous class as a receiver
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_backtrace.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_backtrace.rb b/test/ruby/test_backtrace.rb
index 50d37faa1d..60f9605e40 100644
--- a/test/ruby/test_backtrace.rb
+++ b/test/ruby/test_backtrace.rb
@@ -428,4 +428,23 @@ class TestBacktrace < Test::Unit::TestCase
enum.next
end;
end
+
+ def test_no_receiver_for_anonymous_class
+ err = ["-:2:in 'bar': unhandled exception", # Not '#<Class:0xXXX>.bar'
+ "\tfrom -:3:in '<main>'"]
+ assert_in_out_err([], <<-"end;", [], err)
+ foo = Class.new
+ def foo.bar = raise
+ foo.bar
+ end;
+
+ err = ["-:3:in 'baz': unhandled exception", # Not '#<Class:0xXXX>::Bar.baz'
+ "\tfrom -:4:in '<main>'"]
+ assert_in_out_err([], <<-"end;", [], err)
+ foo = Class.new
+ foo::Bar = Class.new
+ def (foo::Bar).baz = raise
+ foo::Bar.baz
+ end;
+ end
end