summaryrefslogtreecommitdiff
path: root/spec/ruby/language/match_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/match_spec.rb')
-rw-r--r--spec/ruby/language/match_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/language/match_spec.rb b/spec/ruby/language/match_spec.rb
index ebf677cabc..096ebee022 100644
--- a/spec/ruby/language/match_spec.rb
+++ b/spec/ruby/language/match_spec.rb
@@ -46,6 +46,14 @@ describe "The =~ operator with named captures" do
matched.should == "foo"
unmatched.should == nil
end
+
+ it "sets existing local variables if declared in a higher scope" do
+ a = 42
+ 1.times do
+ /(?<a>foo)/ =~ @string
+ end
+ a.should == "foo"
+ end
end
describe "on syntax of 'string_literal' =~ /regexp/" do