aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests/basic.rb
diff options
context:
space:
mode:
authorChris Fallin <cfallin@c1f.net>2015-05-01 14:11:13 -0700
committerChris Fallin <cfallin@c1f.net>2015-05-01 14:11:13 -0700
commit4b2a6328bd2fe6a1d58bbe536c512c566a2673d3 (patch)
tree89693f839c21940349003769811d22ecbb9e78b3 /ruby/tests/basic.rb
parentc881159557398c915b6b279b45c618732741416b (diff)
parentc70b6058eaae4fa5b1af577c548e6809a53dfd98 (diff)
downloadprotobuf-4b2a6328bd2fe6a1d58bbe536c512c566a2673d3.tar.gz
protobuf-4b2a6328bd2fe6a1d58bbe536c512c566a2673d3.tar.bz2
protobuf-4b2a6328bd2fe6a1d58bbe536c512c566a2673d3.zip
Merge pull request #328 from skippy/add-size
ruby: Add size to RepeatField
Diffstat (limited to 'ruby/tests/basic.rb')
-rw-r--r--ruby/tests/basic.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index 1c3fb62c..307374e3 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -377,6 +377,18 @@ module BasicTest
end
end
+ def test_rptfield_array_ducktyping
+ l = Google::Protobuf::RepeatedField.new(:int32)
+ length_methods = %w(count length size)
+ length_methods.each do |lm|
+ assert l.send(lm) == 0
+ end
+ l.push 4
+ length_methods.each do |lm|
+ assert l.send(lm) == 1
+ end
+ end
+
def test_map_basic
# allowed key types:
# :int32, :int64, :uint32, :uint64, :bool, :string, :bytes.
@@ -827,7 +839,6 @@ module BasicTest
assert m['a.b'] == 4
end
-
def test_int_ranges
m = TestMessage.new
@@ -933,7 +944,6 @@ module BasicTest
assert_raise RangeError do
m.optional_uint64 = 1.5
end
-
end
def test_stress_test