mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Freeze Regexp literals
[Feature #8948] [Feature #16377] Since Regexp literals always reference the same instance, allowing to mutate them can lead to state leak.
This commit is contained in:
parent
07aef4c99a
commit
98ef38ada4
Notes:
git
2020-01-15 10:39:11 +09:00
8 changed files with 25 additions and 10 deletions
|
@ -137,7 +137,7 @@ describe "String#match" do
|
|||
end
|
||||
|
||||
it "calls match on the regular expression" do
|
||||
regexp = /./
|
||||
regexp = /./.dup
|
||||
regexp.should_receive(:match).and_return(:foo)
|
||||
'hello'.match(regexp).should == :foo
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue