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.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/ruby/language/match_spec.rb b/spec/ruby/language/match_spec.rb
index 36d347bd57..ebf677cabc 100644
--- a/spec/ruby/language/match_spec.rb
+++ b/spec/ruby/language/match_spec.rb
@@ -48,6 +48,13 @@ describe "The =~ operator with named captures" do
end
end
+ describe "on syntax of 'string_literal' =~ /regexp/" do
+ it "does not set local variables" do
+ 'string literal' =~ /(?<matched>str)(?<unmatched>lit)?/
+ local_variables.should == []
+ end
+ end
+
describe "on syntax of string_variable =~ /regexp/" do
it "does not set local variables" do
@string =~ /(?<matched>foo)(?<unmatched>bar)?/