aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/swapcase_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/swapcase_spec.rb
parented377cc9aaf1ccbede19ddc6c464f5fbf3cabc34 (diff)
downloadruby-809f0b8a1357f14f9645210d4812f4400c8d397e.tar.gz
Update to ruby/spec@f8a2d54
Diffstat (limited to 'spec/ruby/core/string/swapcase_spec.rb')
-rw-r--r--spec/ruby/core/string/swapcase_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/ruby/core/string/swapcase_spec.rb b/spec/ruby/core/string/swapcase_spec.rb
index c1a1608a81..b5d9b20451 100644
--- a/spec/ruby/core/string/swapcase_spec.rb
+++ b/spec/ruby/core/string/swapcase_spec.rb
@@ -86,6 +86,12 @@ describe "String#swapcase!" do
a.should == "CyBeR_pUnK11"
end
+ it "modifies self in place for non-ascii-compatible encodings" do
+ a = "cYbEr_PuNk11".encode("utf-16le")
+ a.swapcase!
+ a.should == "CyBeR_pUnK11".encode("utf-16le")
+ end
+
describe "full Unicode case mapping" do
it "modifies self in place for all of Unicode with no option" do
a = "äÖü"
@@ -93,6 +99,12 @@ describe "String#swapcase!" do
a.should == "ÄöÜ"
end
+ it "works for non-ascii-compatible encodings" do
+ a = "äÖü".encode("utf-16le")
+ a.swapcase!
+ a.should == "ÄöÜ".encode("utf-16le")
+ end
+
it "updates string metadata" do
swapcased = "Aßet"
swapcased.swapcase!
@@ -110,6 +122,12 @@ describe "String#swapcase!" do
a.swapcase!(:ascii)
a.should == "AßET"
end
+
+ it "works for non-ascii-compatible encodings" do
+ a = "aBc".encode("utf-16le")
+ a.swapcase!(:ascii)
+ a.should == "AbC".encode("utf-16le")
+ end
end
describe "modifies self in place for full Unicode case mapping adapted for Turkic languages" do