diff options
Diffstat (limited to 'spec/ruby/core/regexp/shared/quote.rb')
-rw-r--r-- | spec/ruby/core/regexp/shared/quote.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/regexp/shared/quote.rb b/spec/ruby/core/regexp/shared/quote.rb index a55adb5bf2..33bdfd9979 100644 --- a/spec/ruby/core/regexp/shared/quote.rb +++ b/spec/ruby/core/regexp/shared/quote.rb @@ -12,6 +12,11 @@ describe :regexp_quote, shared: true do Regexp.send(@method, :symbol).should == 'symbol' end + it "works with substrings" do + str = ".+[]()"[1...-1] + Regexp.send(@method, str).should == '\+\[\]\(' + end + it "sets the encoding of the result to US-ASCII if there are only US-ASCII characters present in the input String" do str = "abc".force_encoding("euc-jp") Regexp.send(@method, str).encoding.should == Encoding::US_ASCII |