aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests/basic.rb
diff options
context:
space:
mode:
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