diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/envutil.rb | 17 | ||||
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 2 |
2 files changed, 16 insertions, 3 deletions
diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index ab07289876..62f90648c8 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -482,7 +482,7 @@ eom # # pattern_list is anchored. # Use [:*, regexp, :*] for non-anchored match. - def assert_regexp_list(pattern_list, actual, message=nil) + def assert_pattern_list(pattern_list, actual, message=nil) rest = actual anchored = true pattern_list.each {|pattern| @@ -495,7 +495,20 @@ eom match = pattern.match(rest) end unless match - msg = message(msg) { "Expected #{mu_pp pattern}\nto match #{mu_pp rest}" } + msg = message(msg) { + expect_msg = "Expected #{mu_pp pattern}\n" + if /\n[^\n]+\n/ =~ rest + actual_mesg = "to match\n" + prefix = " " + rest.scan(/.*\n+/) { + actual_mesg << ' ' << $&.inspect << "+\n" + } + actual_mesg.sub!(/\+\n\z/, '') + else + actual_mesg = "to match #{mu_pp rest}" + end + expect_msg + actual_mesg + } assert false, msg end rest = match.post_match diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index f94bbb3459..61e11a43fd 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -562,7 +562,7 @@ class TestRubyOptions < Test::Unit::TestCase EnvUtil.diagnostic_reports(Signal.signame(signo), EnvUtil.rubybin, status.pid, Time.now) end - assert_regexp_list(SEGVTest::ExpectedStderrList, stderr, message) + assert_pattern_list(SEGVTest::ExpectedStderrList, stderr, message) status end |