diff options
Diffstat (limited to 'spec/ruby/core/symbol/casecmp_spec.rb')
| -rw-r--r-- | spec/ruby/core/symbol/casecmp_spec.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/ruby/core/symbol/casecmp_spec.rb b/spec/ruby/core/symbol/casecmp_spec.rb index 80ea51e910..dcb77a8350 100644 --- a/spec/ruby/core/symbol/casecmp_spec.rb +++ b/spec/ruby/core/symbol/casecmp_spec.rb @@ -56,20 +56,24 @@ describe "Symbol#casecmp with Symbol" do lower_a_tilde.casecmp(upper_a_tilde).should == 1 lower_a_umlaut.casecmp(upper_a_umlaut).should == 1 end + + it "returns 0 for empty strings in different encodings" do + ''.to_sym.casecmp(''.encode("UTF-32LE").to_sym).should == 0 + end end describe "Symbol#casecmp" do it "returns nil if other is a String" do - :abc.casecmp("abc").should be_nil + :abc.casecmp("abc").should == nil end it "returns nil if other is an Integer" do - :abc.casecmp(1).should be_nil + :abc.casecmp(1).should == nil end it "returns nil if other is an object" do obj = mock("string <=>") - :abc.casecmp(obj).should be_nil + :abc.casecmp(obj).should == nil end end @@ -141,4 +145,8 @@ describe 'Symbol#casecmp?' do upper_a_tilde.casecmp?(lower_a_tilde).should == nil lower_a_tilde.casecmp?(upper_a_tilde).should == nil end + + it "returns true for empty symbols in different encodings" do + ''.to_sym.should.casecmp?(''.encode("UTF-32LE").to_sym) + end end |
