aboutsummaryrefslogtreecommitdiffstats
path: root/tool/lib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-18 23:42:53 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-19 01:28:31 +0900
commitd903e7672637d5a834847820a4e18b00ee30f380 (patch)
treee9ac8cbf0b9c2833446987acdae4c038e0e6ac31 /tool/lib
parent8c44b07fa4b37f3c2a382e11978b743053093159 (diff)
downloadruby-d903e7672637d5a834847820a4e18b00ee30f380.tar.gz
Allow strings in assert_pattern_list
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/core_assertions.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb
index 67373139ca..321ca59f56 100644
--- a/tool/lib/core_assertions.rb
+++ b/tool/lib/core_assertions.rb
@@ -548,11 +548,13 @@ eom
anchored = false
else
if anchored
- match = /\A#{pattern}/.match(rest)
+ match = rest.rindex(pattern, 0)
else
- match = pattern.match(rest)
+ match = rest.index(pattern)
end
- unless match
+ if match
+ post_match = $~ ? $~.post_match : rest[match+pattern.size..-1]
+ else
msg = message(msg) {
expect_msg = "Expected #{mu_pp pattern}\n"
if /\n[^\n]/ =~ rest
@@ -569,7 +571,7 @@ eom
}
assert false, msg
end
- rest = match.post_match
+ rest = post_match
anchored = true
end
}