summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-07 13:50:20 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-07 13:52:53 +0900
commit6ed1a5e0e62bbdadcf3d0c61fcfe0c5f8d01789b (patch)
tree67bba493473eb19a0bdfe34978366c03016a15a0
parentdedcf62b13bed5452dbc82590b828805b727bb28 (diff)
Made a test more robust
Against changes of the `assert_separately` prologue code.
-rw-r--r--test/ruby/test_module.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 2e0a14e3002..5194a56a8c6 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -2393,7 +2393,10 @@ class TestModule < Test::Unit::TestCase
def test_inspect_segfault
bug_10282 = '[ruby-core:65214] [Bug #10282]'
- assert_separately [], <<-RUBY
+ assert_separately [], "#{<<~"begin;"}\n#{<<~'end;'}"
+ bug_10282 = "#{bug_10282}"
+ begin;
+ line = __LINE__ + 2
module ShallowInspect
def shallow_inspect
"foo"
@@ -2410,9 +2413,9 @@ class TestModule < Test::Unit::TestCase
A.prepend InspectIsShallow
- expect = "#<Method: A(ShallowInspect)#inspect(shallow_inspect)() -:7>"
- assert_equal expect, A.new.method(:inspect).inspect, "#{bug_10282}"
- RUBY
+ expect = "#<Method: A(ShallowInspect)#inspect(shallow_inspect)() -:#{line}>"
+ assert_equal expect, A.new.method(:inspect).inspect, bug_10282
+ end;
end
def test_define_method_with_unbound_method