diff --git a/lib/memcached/client.rb b/lib/memcached/client.rb index ed616b9..cc1a0a6 100644 --- a/lib/memcached/client.rb +++ b/lib/memcached/client.rb @@ -149,7 +149,7 @@ module Memcached servers = [servers] if servers.is_a?(String) servers.map do |server| server = server.to_s - if server =~ /^[\w\d\.-]+(:\d{1,5}){0,2}$/ + if server =~ /^[\w\.-]+(:\d{1,5}){0,2}$/ host, port, _weight = server.split(":") # TODO weight [:tcp, host, port.to_i] diff --git a/test/unit/memcached_experimental_test.rb b/test/unit/memcached_experimental_test.rb index 25bf8a4..2b9ca7e 100644 --- a/test/unit/memcached_experimental_test.rb +++ b/test/unit/memcached_experimental_test.rb @@ -89,7 +89,7 @@ class MemcachedExperimentalTest # TODO value = "Test that we cannot get 0 bytes with a get_len call." @experimental_cache.set key, value, 0, false assert_raises(Memcached::Failure) do - result = @experimental_cache.get_len 0, key + @experimental_cache.get_len 0, key end end end @@ -119,7 +119,7 @@ class MemcachedExperimentalTest # TODO server_get_len_capable do @experimental_binary_protocol_cache.set key, @value assert_raises(Memcached::ActionNotSupported) do - result = @experimental_binary_protocol_cache.get_len 2, key + @experimental_binary_protocol_cache.get_len 2, key end end end @@ -173,7 +173,7 @@ class MemcachedExperimentalTest # TODO @experimental_binary_protocol_cache.set key_1, value_1, 0, false @experimental_binary_protocol_cache.set key_2, value_2, 0, false assert_raises(Memcached::ActionNotSupported) do - result = @experimental_binary_protocol_cache.get_len 2, keys + @experimental_binary_protocol_cache.get_len 2, keys end end end @@ -191,9 +191,9 @@ class MemcachedExperimentalTest # TODO def test_get_len_failure server_get_len_capable do - value = "Test that we cannot use get_len without setting the :experimental_features config." + # Test that we cannot use get_len without setting the :experimental_features config assert_raises(NoMethodError) do - result = @cache.get_len 10, key + @cache.get_len 10, key end end end diff --git a/test/unit/memcached_test.rb b/test/unit/memcached_test.rb index 11e7dc5..56ec10d 100644 --- a/test/unit/memcached_test.rb +++ b/test/unit/memcached_test.rb @@ -260,7 +260,7 @@ class MemcachedTest # TODO cache.get(key2) rescue => e assert_equal Memcached::ServerIsMarkedDead, e.class - assert_match /localhost:43041/, e.message + assert_match(/localhost:43041/, e.message) end # Hit first server on retry @@ -335,7 +335,7 @@ class MemcachedTest # TODO cache.get(key2) rescue => e assert_equal Memcached::ServerIsMarkedDead, e.class - assert_match /localhost:43041/, e.message + assert_match(/localhost:43041/, e.message) end assert_nothing_raised do @@ -349,7 +349,7 @@ class MemcachedTest # TODO cache.get(key2) rescue => e assert_equal Memcached::ServerIsMarkedDead, e.class - assert_match /localhost:43041/, e.message + assert_match(/localhost:43041/, e.message) end assert_nothing_raised do @@ -380,7 +380,7 @@ class MemcachedTest # TODO cache.get(key2) rescue => e assert_equal Memcached::ServerIsMarkedDead, e.class - assert_match /localhost:43041/, e.message + assert_match(/localhost:43041/, e.message) end sleep(2) @@ -390,7 +390,7 @@ class MemcachedTest # TODO cache.get(key2) rescue => e assert_equal Memcached::ServerIsMarkedDead, e.class - assert_match /localhost:43041/, e.message + assert_match(/localhost:43041/, e.message) end ensure socket.close @@ -443,7 +443,7 @@ class MemcachedTest # TODO cache.get(key2) rescue => e assert_equal Memcached::ServerIsMarkedDead, e.class - assert_match /localhost:43041/, e.message + assert_match(/localhost:43041/, e.message) end # Hit first server on retry