diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-13 21:58:54 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-13 21:58:54 +0000 |
commit | b46da8d84efeb97cb52ba0560d5b149ccda0d561 (patch) | |
tree | 382ba848ef97215f1a5ec991727db3ed7f90973c /spec/ruby/core/string/casecmp_spec.rb | |
parent | 5b55eaa00db05004d1a6b74c3aaa5e680fc73235 (diff) | |
download | ruby-b46da8d84efeb97cb52ba0560d5b149ccda0d561.tar.gz |
Update to ruby/spec@4bb0f25
* Specs added by TruffleRuby.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/string/casecmp_spec.rb')
-rw-r--r-- | spec/ruby/core/string/casecmp_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/ruby/core/string/casecmp_spec.rb b/spec/ruby/core/string/casecmp_spec.rb index 9e89e1314d..87be999964 100644 --- a/spec/ruby/core/string/casecmp_spec.rb +++ b/spec/ruby/core/string/casecmp_spec.rb @@ -37,6 +37,10 @@ describe "String#casecmp independent of case" do end end + it "returns nil if incompatible encodings" do + "あれ".casecmp("れ".encode(Encoding::EUC_JP)).should be_nil + end + describe "in UTF-8 mode" do describe "for non-ASCII characters" do before :each do @@ -96,6 +100,12 @@ describe "String#casecmp independent of case" do it "returns 1 when numerically greater than other" do @lower_a_tilde.casecmp(@upper_a_tilde).should == 1 end + + ruby_version_is "2.4" do + it "does not case fold" do + "ß".casecmp("ss").should == 1 + end + end end describe "when comparing a subclass instance" do @@ -138,6 +148,10 @@ ruby_version_is "2.4" do "abc".casecmp?(other).should == true end + it "returns nil if incompatible encodings" do + "あれ".casecmp?("れ".encode(Encoding::EUC_JP)).should be_nil + end + describe 'for UNICODE characters' do it 'returns true when downcase(:fold) on unicode' do 'äöü'.casecmp?('ÄÖÜ').should == true @@ -181,6 +195,12 @@ ruby_version_is "2.4" do end end + ruby_version_is "2.4" do + it "case folds" do + "ß".casecmp?("ss").should be_true + end + end + ruby_version_is "2.4" ... "2.5" do it "raises a TypeError if other can't be converted to a string" do lambda { "abc".casecmp?(mock('abc')) }.should raise_error(TypeError) |