Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions mrbgems/mruby-regexp/test/string_index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -607,13 +607,17 @@ def fake.match(str, pos = 0); raise "must not be called"; end
assert_nil $2
assert_equal "b", $+

# and a search that finds nothing clears all of them, not `$~` alone
"zzz" =~ /(z)/
# and a search that finds nothing clears all of them, not `$~` alone. Two
# groups are seeded so that a `$2` left standing is one the clear missed
# rather than one no seed ever filled
"zzz" =~ /(z)(z)/
assert_nil "abc".rindex(/x/)
assert_nil $~
assert_nil $&
assert_nil $`
assert_nil $'
assert_nil $1
assert_nil $2
assert_nil $+
end

Expand Down
Loading