aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/upcase_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-01-28 20:47:48 +0100
committerBenoit Daloze <eregontp@gmail.com>2020-01-28 20:47:48 +0100
commit809f0b8a1357f14f9645210d4812f4400c8d397e (patch)
tree7ce6192f94b1dc4b004798aa5d0c4d6bac02577f /spec/ruby/core/string/upcase_spec.rb
parented377cc9aaf1ccbede19ddc6c464f5fbf3cabc34 (diff)
downloadruby-809f0b8a1357f14f9645210d4812f4400c8d397e.tar.gz
Update to ruby/spec@f8a2d54
Diffstat (limited to 'spec/ruby/core/string/upcase_spec.rb')
-rw-r--r--spec/ruby/core/string/upcase_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/ruby/core/string/upcase_spec.rb b/spec/ruby/core/string/upcase_spec.rb
index eb7d708fe0..4857079a84 100644
--- a/spec/ruby/core/string/upcase_spec.rb
+++ b/spec/ruby/core/string/upcase_spec.rb
@@ -85,6 +85,12 @@ describe "String#upcase!" do
a.should == "HELLO"
end
+ it "modifies self in place for non-ascii-compatible encodings" do
+ a = "HeLlO".encode("utf-16le")
+ a.upcase!
+ a.should == "HELLO".encode("utf-16le")
+ end
+
describe "full Unicode case mapping" do
it "modifies self in place for all of Unicode with no option" do
a = "äöü"
@@ -92,6 +98,12 @@ describe "String#upcase!" do
a.should == "ÄÖÜ"
end
+ it "works for non-ascii-compatible encodings" do
+ a = "äöü".encode("utf-16le")
+ a.upcase!
+ a.should == "ÄÖÜ".encode("utf-16le")
+ end
+
it "updates string metadata for self" do
upcased = "aßet"
upcased.upcase!
@@ -109,6 +121,12 @@ describe "String#upcase!" do
a.upcase!(:ascii)
a.should == "AßET"
end
+
+ it "works for non-ascii-compatible encodings" do
+ a = "abc".encode("utf-16le")
+ a.upcase!(:ascii)
+ a.should == "ABC".encode("utf-16le")
+ end
end
describe "modifies self in place for full Unicode case mapping adapted for Turkic languages" do