Miscellaneous warnings regarding Ruby syntax (shown in Ruby 2.1+)
This commit is contained in:
Vicent Marti 2016-03-16 09:30:41 +01:00
Родитель c9fdb406ea
Коммит 2608d41e3a
3 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -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]

Просмотреть файл

@ -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

Просмотреть файл

@ -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