aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/envutil.rb
diff options
context:
space:
mode:
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