diff options
| author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-19 09:05:50 +0000 |
|---|---|---|
| committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-19 09:05:50 +0000 |
| commit | 23eee58879acb925f31efe31da18172fea85360c (patch) | |
| tree | ea485a6ca5e562543e225ca8d8e0a450f44c583f /lib | |
| parent | 759b34c22956175aac20783218a16d2b75e0d51b (diff) | |
| download | ruby-23eee58879acb925f31efe31da18172fea85360c.tar.gz ruby-23eee58879acb925f31efe31da18172fea85360c.tar.xz ruby-23eee58879acb925f31efe31da18172fea85360c.zip | |
* lib/ipaddr.rb (to_s, test_to_s): too many colons with some cases.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ipaddr.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb index 24543ce09..c011676c1 100644 --- a/lib/ipaddr.rb +++ b/lib/ipaddr.rb @@ -207,6 +207,7 @@ class IPAddr break if str.sub!(/\b0:0\b/, ':') break end + str.sub!(/:{3,}/, '::') if /\A::(ffff:)?([\da-f]{1,4}):([\da-f]{1,4})\Z/i =~ str str = sprintf('::%s%d.%d.%d.%d', $1, $2.hex / 256, $2.hex % 256, $3.hex / 256, $3.hex % 256) @@ -602,7 +603,6 @@ class TC_IPAddr < Test::Unit::TestCase IPAddr.new(*args) } } - end def test_s_new_ntoh addr = '' @@ -674,6 +674,10 @@ class TC_IPAddr < Test::Unit::TestCase } end + def test_to_s + assert_equal("3ffe:0505:0002:0000:0000:0000:0000:0001", IPAddr.new("3ffe:505:2::1").to_string) + assert_equal("3ffe:505:2::1", IPAddr.new("3ffe:505:2::1").to_s) + end end class TC_Operator < Test::Unit::TestCase |
