зеркало из https://github.com/github/memcached.git
Fix Ruby warnings
Miscellaneous warnings regarding Ruby syntax (shown in Ruby 2.1+)
This commit is contained in:
Родитель
c9fdb406ea
Коммит
2608d41e3a
|
@ -149,7 +149,7 @@ module Memcached
|
||||||
servers = [servers] if servers.is_a?(String)
|
servers = [servers] if servers.is_a?(String)
|
||||||
servers.map do |server|
|
servers.map do |server|
|
||||||
server = server.to_s
|
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(":")
|
host, port, _weight = server.split(":")
|
||||||
# TODO weight
|
# TODO weight
|
||||||
[:tcp, host, port.to_i]
|
[:tcp, host, port.to_i]
|
||||||
|
|
|
@ -89,7 +89,7 @@ class MemcachedExperimentalTest # TODO
|
||||||
value = "Test that we cannot get 0 bytes with a get_len call."
|
value = "Test that we cannot get 0 bytes with a get_len call."
|
||||||
@experimental_cache.set key, value, 0, false
|
@experimental_cache.set key, value, 0, false
|
||||||
assert_raises(Memcached::Failure) do
|
assert_raises(Memcached::Failure) do
|
||||||
result = @experimental_cache.get_len 0, key
|
@experimental_cache.get_len 0, key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -119,7 +119,7 @@ class MemcachedExperimentalTest # TODO
|
||||||
server_get_len_capable do
|
server_get_len_capable do
|
||||||
@experimental_binary_protocol_cache.set key, @value
|
@experimental_binary_protocol_cache.set key, @value
|
||||||
assert_raises(Memcached::ActionNotSupported) do
|
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
|
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_1, value_1, 0, false
|
||||||
@experimental_binary_protocol_cache.set key_2, value_2, 0, false
|
@experimental_binary_protocol_cache.set key_2, value_2, 0, false
|
||||||
assert_raises(Memcached::ActionNotSupported) do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -191,9 +191,9 @@ class MemcachedExperimentalTest # TODO
|
||||||
|
|
||||||
def test_get_len_failure
|
def test_get_len_failure
|
||||||
server_get_len_capable do
|
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
|
assert_raises(NoMethodError) do
|
||||||
result = @cache.get_len 10, key
|
@cache.get_len 10, key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -260,7 +260,7 @@ class MemcachedTest # TODO
|
||||||
cache.get(key2)
|
cache.get(key2)
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal Memcached::ServerIsMarkedDead, e.class
|
assert_equal Memcached::ServerIsMarkedDead, e.class
|
||||||
assert_match /localhost:43041/, e.message
|
assert_match(/localhost:43041/, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hit first server on retry
|
# Hit first server on retry
|
||||||
|
@ -335,7 +335,7 @@ class MemcachedTest # TODO
|
||||||
cache.get(key2)
|
cache.get(key2)
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal Memcached::ServerIsMarkedDead, e.class
|
assert_equal Memcached::ServerIsMarkedDead, e.class
|
||||||
assert_match /localhost:43041/, e.message
|
assert_match(/localhost:43041/, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_nothing_raised do
|
assert_nothing_raised do
|
||||||
|
@ -349,7 +349,7 @@ class MemcachedTest # TODO
|
||||||
cache.get(key2)
|
cache.get(key2)
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal Memcached::ServerIsMarkedDead, e.class
|
assert_equal Memcached::ServerIsMarkedDead, e.class
|
||||||
assert_match /localhost:43041/, e.message
|
assert_match(/localhost:43041/, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_nothing_raised do
|
assert_nothing_raised do
|
||||||
|
@ -380,7 +380,7 @@ class MemcachedTest # TODO
|
||||||
cache.get(key2)
|
cache.get(key2)
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal Memcached::ServerIsMarkedDead, e.class
|
assert_equal Memcached::ServerIsMarkedDead, e.class
|
||||||
assert_match /localhost:43041/, e.message
|
assert_match(/localhost:43041/, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
@ -390,7 +390,7 @@ class MemcachedTest # TODO
|
||||||
cache.get(key2)
|
cache.get(key2)
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal Memcached::ServerIsMarkedDead, e.class
|
assert_equal Memcached::ServerIsMarkedDead, e.class
|
||||||
assert_match /localhost:43041/, e.message
|
assert_match(/localhost:43041/, e.message)
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
socket.close
|
socket.close
|
||||||
|
@ -443,7 +443,7 @@ class MemcachedTest # TODO
|
||||||
cache.get(key2)
|
cache.get(key2)
|
||||||
rescue => e
|
rescue => e
|
||||||
assert_equal Memcached::ServerIsMarkedDead, e.class
|
assert_equal Memcached::ServerIsMarkedDead, e.class
|
||||||
assert_match /localhost:43041/, e.message
|
assert_match(/localhost:43041/, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Hit first server on retry
|
# Hit first server on retry
|
||||||
|
|
Загрузка…
Ссылка в новой задаче