summaryrefslogtreecommitdiff
path: root/spec/ruby/core/regexp
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2022-06-26 14:50:14 +0200
committerBenoit Daloze <[email protected]>2022-06-26 14:50:14 +0200
commitd3d5ef0cca160fca538c7f556c5a6e08df5847e6 (patch)
tree57358b4b9cdd6f429d0383005ac393cb74dd3bff /spec/ruby/core/regexp
parentf616e816372d14e605879d2e43c7fbdda29ef837 (diff)
Update to ruby/spec@ab32a1a
Diffstat (limited to 'spec/ruby/core/regexp')
-rw-r--r--spec/ruby/core/regexp/shared/quote.rb5
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