Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
05c2d01b
Commit
05c2d01b
authored
Apr 30, 2018
by
Stuart Campbell
Committed by
Paul Yang
Apr 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix RepeatedField#delete_if (#4292)
Make RepeatedField#delete_if consistent with Array#delete_if.
parent
0869b1a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
repeated_field.rb
ruby/lib/google/protobuf/repeated_field.rb
+2
-2
repeated_field_test.rb
ruby/tests/repeated_field_test.rb
+9
-0
No files found.
ruby/lib/google/protobuf/repeated_field.rb
View file @
05c2d01b
...
...
@@ -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
...
...
ruby/tests/repeated_field_test.rb
View file @
05c2d01b
...
...
@@ -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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment