[前][次][番号順一覧][スレッド一覧]

ruby-changes:46722

From: stomar <ko1@a...>
Date: Mon, 22 May 2017 04:31:41 +0900 (JST)
Subject: [ruby-changes:46722] stomar:r58839 (trunk): String#casecmp no longer raises TypeError

stomar	2017-05-22 04:31:37 +0900 (Mon, 22 May 2017)

  New Revision: 58839

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58839

  Log:
    String#casecmp no longer raises TypeError
    
    * See https://bugs.ruby-lang.org/issues/13312

  Modified files:
    trunk/spec/rubyspec/core/string/casecmp_spec.rb
Index: spec/rubyspec/core/string/casecmp_spec.rb
===================================================================
--- spec/rubyspec/core/string/casecmp_spec.rb	(revision 58838)
+++ spec/rubyspec/core/string/casecmp_spec.rb	(revision 58839)
@@ -25,8 +25,16 @@ describe "String#casecmp independent of https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/core/string/casecmp_spec.rb#L25
     "abc".casecmp(other).should == 0
   end
 
-  it "raises a TypeError if other can't be converted to a string" do
-    lambda { "abc".casecmp(mock('abc')) }.should raise_error(TypeError)
+  ruby_version_is ""..."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)
+    end
+  end
+
+  ruby_version_is "2.5" do
+    it "returns nil if other can't be converted to a string" do
+      "abc".casecmp(mock('abc')).should be_nil
+    end
   end
 
   describe "in UTF-8 mode" do

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]