summaryrefslogtreecommitdiff
path: root/spec/ruby/core/regexp/shared
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2022-07-27 17:18:25 +0200
committerBenoit Daloze <[email protected]>2022-07-27 17:18:25 +0200
commit6582df26dcdef5dab01242b4d97d9b242e959860 (patch)
tree99824a5c370ef27acd12905b67304870f1af9561 /spec/ruby/core/regexp/shared
parent44f42413e6c3c2b487a03b53bf6cacbb83ac285b (diff)
Update to ruby/spec@cbfaf51
Diffstat (limited to 'spec/ruby/core/regexp/shared')
-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 33bdfd9979..9533102766 100644
--- a/spec/ruby/core/regexp/shared/quote.rb
+++ b/spec/ruby/core/regexp/shared/quote.rb
@@ -17,6 +17,11 @@ describe :regexp_quote, shared: true do
Regexp.send(@method, str).should == '\+\[\]\('
end
+ it "works for broken strings" do
+ Regexp.send(@method, "a.\x85b.".force_encoding("US-ASCII")).should =="a\\.\x85b\\.".force_encoding("US-ASCII")
+ Regexp.send(@method, "a.\x80".force_encoding("UTF-8")).should == "a\\.\x80".force_encoding("UTF-8")
+ 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