summaryrefslogtreecommitdiff
path: root/test/ruby/envutil.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-15 08:59:46 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-15 08:59:46 +0000
commite1ba2d418ad6f4e9e63e9db05ff5602e0f379652 (patch)
tree50302c5807a4fe65e5341b0315076aeaf5f8f8a9 /test/ruby/envutil.rb
parent723cee93c481e62579e5353d9128e1538381cbab (diff)
* test/ruby/envutil.rb (assert_pattern_list) Renamed from
assert_regexp_list. Show multiline string in multi lines. * test/-ext-/bug_reporter/test_bug_reporter.rb: Use assert_pattern_list. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/envutil.rb')
-rw-r--r--test/ruby/envutil.rb17
1 files changed, 15 insertions, 2 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