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

ruby-changes:36990

From: nobu <ko1@a...>
Date: Tue, 30 Dec 2014 16:03:58 +0900 (JST)
Subject: [ruby-changes:36990] nobu:r49071 (trunk): resolv.rb: dots differences

nobu	2014-12-30 16:03:47 +0900 (Tue, 30 Dec 2014)

  New Revision: 49071

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

  Log:
    resolv.rb: dots differences
    
    * lib/resolv.rb (Resolv::DNS::Name): names with different dots
      should be different.

  Modified files:
    trunk/ChangeLog
    trunk/lib/resolv.rb
    trunk/test/resolv/test_dns.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49070)
+++ ChangeLog	(revision 49071)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec 30 16:03:45 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* lib/resolv.rb (Resolv::DNS::Name): names with different dots
+	  should be different.
+
 Tue Dec 30 13:16:56 2014  Martin Duerst  <bernhard+git@l...>
 
 	* lib/uri/common.rb: Initialize HTML5ASCIIINCOMPAT to empty Array
Index: lib/resolv.rb
===================================================================
--- lib/resolv.rb	(revision 49070)
+++ lib/resolv.rb	(revision 49071)
@@ -1236,7 +1236,8 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L1236
 
       def ==(other) # :nodoc:
         return false unless Name === other
-        return @labels.join == other.to_a.join && @absolute == other.absolute?
+        return @labels.join('.') == other.to_a.join('.') &&
+          @absolute == other.absolute?
       end
 
       alias eql? == # :nodoc:
Index: test/resolv/test_dns.rb
===================================================================
--- test/resolv/test_dns.rb	(revision 49070)
+++ test/resolv/test_dns.rb	(revision 49071)
@@ -177,4 +177,10 @@ class TestResolvDNS < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/test/resolv/test_dns.rb#L177
       end
     end
   end
+
+  def test_case_insensitive_name
+    name1 = Resolv::DNS::Name.create("example.org")
+    name2 = Resolv::DNS::Name.create("ex.ampl.eo.rg")
+    assert_not_equal(name1, name2, "different dots")
+  end
 end

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

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