1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
* Specs added by TruffleRuby.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-06-13 21:58:54 +00:00
parent 5b55eaa00d
commit b46da8d84e
24 changed files with 812 additions and 57 deletions

View file

@ -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)