Commit 05c2d01b authored by Stuart Campbell's avatar Stuart Campbell Committed by Paul Yang

Fix RepeatedField#delete_if (#4292)

Make RepeatedField#delete_if consistent with Array#delete_if.
parent 0869b1a0
......@@ -150,12 +150,12 @@ module Google
end
%w(delete delete_at delete_if shift slice! unshift).each do |method_name|
%w(delete delete_at shift slice! unshift).each do |method_name|
define_array_wrapper_method(method_name)
end
%w(collect! compact! fill flatten! insert reverse!
%w(collect! compact! delete_if fill flatten! insert reverse!
rotate! select! shuffle! sort! sort_by! uniq!).each do |method_name|
define_array_wrapper_with_result_method(method_name)
end
......
......@@ -369,6 +369,15 @@ class RepeatedFieldTest < Test::Unit::TestCase
end
end
def test_delete_if
m = TestMessage.new
reference_arr = %w(foo bar baz)
m.repeated_string += reference_arr.clone
check_self_modifying_method(m.repeated_string, reference_arr) do |arr|
arr.delete_if { |v| v == "bar" }
end
end
def test_fill
m = TestMessage.new
reference_arr = %w(foo bar baz)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment